You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exit codes >= 126 crash the WASI build instead of exiting cleanly #16594
wasi_snapshot_preview1::proc_exit only accepts exit statuses in [0, 126). A status at or above that range makes wasmtime trap the whole module, instead of exiting with that status.
Several utilities use exit codes in that reserved range on purpose, following shell convention:
126: command found but not executable (nice, env, nohup, timeout)
127: command not found (nice, env, nohup, timeout)
128 + signal: process killed by a signal (timeout, stdbuf)
Under the feat_wasm build, these codes are reachable even though the underlying subprocess spawning itself is unsupported on WASI (see the companion issue): the command always fails to exec, and the exec-failure path tries to report 126 or 127. Before this is fixed, that crashes the module with a wasmtime trap like:
Error: failed to run main module `coreutils.wasm`
...
2: exit with invalid exit status outside of [0..126)
instead of a clean, catchable nonzero exit.
Reproduction
$ wasmtime coreutils.wasm nice true
nice: 'true': operation not supported on this platform
Error: failed to run main module `coreutils.wasm`
...
2: exit with invalid exit status outside of [0..126)
Expected
The binary exits cleanly with a nonzero status, without a wasmtime trap.
Activity
oech3 commentedon Nov 17, 2026
Is this something we can fix at upstream instead of here?
eduardomourar commentedon Nov 17, 2026
It was already brought up in WASI #551 and wasmtime #6919. The problem is that WASI Preview 1 will unlikely to be updated as it is finalized.