wasm-opt fail with [parse exception: invalid code after misc prefix: 17 (at 0:61491)]
Author: WayonbCreated Oct 30, 2024Updated Jun 10, 2026
Bug description
Our build was working up to rust 1.81.0. With Rustc 1.82.0, I am getting an error with wasm-opt.
Expected Behavior
wasm-opt should work with rustc 1.82.0
Steps to reproduce
wasm-pack build --release --no-typescript --target nodejs --out-dir ../_build/wasm/node
[INFO]: Checking for the Wasm target...
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
18.7 MiB / 18.7 MiB (100 %) 13.8 MiB/s in 1s ETA: 0s
[INFO]: Compiling to Wasm...
Finished `release` profile [optimized] target(s) in 0.08s
[INFO]: Installing wasm-bindgen...
[INFO]: found wasm-opt at "/usr/bin/wasm-opt"
[INFO]: Optimizing wasm binaries with `wasm-opt`...
[parse exception: invalid code after misc prefix: 17 (at 0:61491)]
Fatal: error parsing wasm
Error: failed to execute `wasm-opt`: exited with exit status: 1
full command: "/usr/bin/wasm-opt" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm" "-o" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm-opt.wasm" "-O"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to execute `wasm-opt`: exited with exit status: 1
full command: "/usr/bin/wasm-opt" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm" "-o" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm-opt.wasm" "-O"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.Your environment
Include the relevant details of your environment. Ubuntu 24.04(it works on MacOs) wasm-pack version: wasm-pack -V wasm-pack 0.13.1
rustc version: rustc -V rustc 1.82.0 (f6e511eec 2024-10-15)
Source: wasm-bindgen/wasm-pack