wasmedge validate CLI
After installation, users can execute the wasmedge validate command.
The wasmedge validate command loads a WebAssembly module and runs the validation phase, checking that the module conforms to the WebAssembly specification. It does not instantiate or execute the module. This is useful for verifying correctness of a WASM binary before deployment or execution.
$ wasmedge validate -h
USAGE
wasmedge validate [OPTIONS] [--] WASM_OR_SO
...
Options
The options of the wasmedge validate command are as follows.
-h|--help: Show the help messages. Will ignore the other arguments below.- (Optional)
--log-level: Set logging level. Valid values:off,trace,debug,info,warning,error,fatal. Default isinfo. - (Optional)
--forbidden-plugin: List of plugins to ignore. - (Optional) WebAssembly proposals:
- Use
--wasm-1to set the environment as WASM 1.0 standard. This standard includes the following proposals: - Use
--wasm-2to set the environment as WASM 2.0 standard. This standard includes the WASM 1.0 and following proposals: - Use
--wasm-3to set the environment as WASM 3.0 standard (Currently default since 0.16.0). This standard includes the WASM 2.0 and following proposals: - Use
--disable-import-export-mut-globalsto disable the Import/Export of Mutable Globals proposal (DefaultON). - Use
--disable-non-trap-float-to-intto disable the Non-Trapping Float-to-Int Conversions proposal (DefaultON). - Use
--disable-sign-extension-operatorsto disable the Sign-Extension Operators proposal (DefaultON). - Use
--disable-multi-valueto disable the Multi-value proposal (DefaultON). - Use
--disable-bulk-memoryto disable the Bulk Memory Operations proposal (DefaultON). - Use
--disable-reference-typesto disable the Reference Types proposal (DefaultON). - Use
--disable-simdto disable the Fixed-width SIMD proposal (DefaultON). - Use
--disable-tail-callto disable the Tail call proposal (DefaultON). - Use
--disable-extended-constto disable the Extended Constant Expressions proposal (DefaultON). - Use
--disable-function-referenceto disable the Typed-Function References proposal (DefaultON). - Use
--disable-gcto disable the Garbage Collection proposal (DefaultON). - Use
--disable-multi-memoryto disable the Multiple Memories proposal (DefaultON). - Use
--disable-relaxed-simdto disable the Relaxed SIMD proposal (DefaultON). - Use
--disable-exception-handlingto disable the Exception Handling proposal (DefaultON). - Use
--enable-threadsto enable the Threads proposal (DefaultOFF). - Use
--enable-componentto enable the Component Model proposal (DefaultOFF, loader phase only). - Use
--enable-allto enable ALL proposals above.
- Use
- Input WASM file (
/path/to/wasm/file).
Example
Validating a correct module
We created the hand-written fibonacci.wat and used the wat2wasm tool to convert it into the fibonacci.wasm WebAssembly program. It exported a fib() function which takes a single i32 integer as the input parameter.
You can run:
wasmedge validate fibonacci.wasm
The output will be:
[2026-03-24 02:07:35.939] [info] Validation succeeded.
The exit code will be 0.
Validating an invalid module
We created the hand-written bad_validate.wat and used the wat2wasm tool to convert it into the bad_validate.wasm WebAssembly program. This module intentionally contains a type mismatch to demonstrate validation failure.
You can run:
wasmedge validate bad_validate.wasm
The output will be:
[2026-03-24 02:08:49.475] [error] validation failed: type mismatch, Code: 0x202
[2026-03-24 02:08:49.475] [error] Mismatched value type. Expected: i32 , Got: i64
[2026-03-24 02:08:49.475] [error] In instruction: end (0x08) , Bytecode offset: 0x00000026
[2026-03-24 02:08:49.475] [error] At AST node: expression
[2026-03-24 02:08:49.475] [error] At AST node: code segment
[2026-03-24 02:08:49.475] [error] At AST node: code section
[2026-03-24 02:08:49.475] [error] At AST node: module
The exit code will be 1.