Skip to content
Latchkey

wasm-validate: Validate a Wasm Module in CI

wasm-validate confirms a binary module passes WebAssembly validation, exiting non-zero with a message when it does not.

A cheap CI gate: run wasm-validate on every produced module so a malformed artifact fails the build immediately rather than at load time in a runtime.

What it does

wasm-validate parses and validates a .wasm against the spec (types, function bodies, imports/exports). It prints nothing and exits 0 on success; on failure it prints "error: <detail>" and exits non-zero.

Common usage

Terminal
wasm-validate module.wasm
wasm-validate module.wasm --enable-simd
wasm-validate module.wasm --enable-all
wasm-validate module.wasm && echo valid

Options

FlagWhat it does
--enable-<feature>Allow a proposal feature during validation
--enable-allEnable all supported proposals
--no-check-...Relax specific checks (rarely needed)

In CI

Add wasm-validate as a step after any wasm build; it is fast and catches corrupt or feature-mismatched output before it reaches a runtime. Enable exactly the proposals your toolchain emits or valid modules are wrongly rejected.

Common errors in CI

"error: ... type mismatch" or "error: function ... expected ... got ..." means a genuine validation failure in the module. "error: ... requires <feature>" means a proposal instruction was used without --enable-. "error: magic mismatch" means the input is not a wasm binary at all.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →