DioxusLabs/dioxus · error
Unknown platform for wasm-opt installation. Please install w
Error message
Unknown platform for wasm-opt installation. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH.
What it means
Terminal guard of the cfg!-based if/else chain in find_latest_wasm_opt_download_url. Fires when the build host's OS/architecture pair is not one of the four prebuilt wasm-opt targets (x86_64/arm64 on windows/linux), so no binaryen release asset can be matched and the download URL cannot be resolved.
Source
Thrown at packages/cli/src/wasm_opt.rs:185
.get("assets")
.and_then(|assets| assets.as_array())
.ok_or_else(|| anyhow::anyhow!("Failed to parse assets"))?;
// Find the platform identifier based on the current OS and architecture
let platform = if cfg!(all(target_os = "windows", target_arch = "x86_64")) {
"x86_64-windows"
} else if cfg!(all(target_os = "windows", target_arch = "aarch64")) {
"arm64-windows"
} else if cfg!(all(target_os = "linux", target_arch = "x86_64")) {
"x86_64-linux"
} else if cfg!(all(target_os = "linux", target_arch = "aarch64")) {
"aarch64-linux"
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
"x86_64-macos"
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
"arm64-macos"
} else {
bail!(
"Unknown platform for wasm-opt installation. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH."
);
};
// Find the first asset with a name that contains the platform string
let asset = assets
.iter()
.find(|asset| {
asset
.get("name")
.and_then(|name| name.as_str())
.is_some_and(|name| name.contains(platform) && !name.ends_with("sha256"))
})
.with_context(|| anyhow!(
"No suitable wasm-opt binary found for platform: {}. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH.",
platform
))?;
View on GitHub (pinned to 24f6a829df)
Solutions
- No wasm-opt build exists for this platform. Install wasm-opt manually from the binaryen releases and add it to PATH.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/cli/src/wasm_opt.rs:185 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/93053c705dc94fd7.
Report an issue: GitHub.