e01.org

unreachable: Wasm text instruction

unreachable is used to denote a point in code that should not be reachable. unreachable is an unconditional trap: in the case where an unreachable is reached and executed, the instruction traps.

**`unreachable`** is used to denote a point in code that should not be reachable. `unreachable` is an unconditional trap: in the case where an `unreachable` is reached and executed, the instruction traps.

tabbed-shorter

```wat interactive-example
(module
(func (export "throw")
unreachable
)
)
```

```js interactive-example
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url)).then((result) => {
result.instance.exports.throw();
// Expected output: RuntimeError: unreachable
});
```

## Syntax

```wat
unreachable
```

| Instruction | Binary opcode |
| ------------- | ------------- |
| `unreachable` | `0x00` |

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"unreachable: Wasm text instruction". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/unreachable

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·