{"record":{"id":"4347478e9960fd16","repo":"astrid-runtime/astrid","slug":"cargo-build-failed-set-build-target-wasm32","errorCode":null,"errorMessage":"Cargo build failed. Set `[build] target = \"wasm32-unknown-unknown\"` (Astrid-canonical) or `wasm32-wasip2` in `.cargo/config.toml` and install the matching `rustup target` component.","messagePattern":"Cargo build failed\\. Set `\\[build\\] target = \"wasm32-unknown-unknown\"` \\(Astrid-canonical\\) or `wasm32-wasip2` in `\\.cargo/config\\.toml` and install the matching `rustup target` component\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust.rs","lineNumber":295,"sourceCode":"        {\n            continue;\n        }\n        artifacts.extend(\n            artifact\n                .filenames\n                .into_iter()\n                .filter(|path| {\n                    path.file_name()\n                        .is_some_and(|name| name == expected_filename)\n                })\n                .map(cargo_metadata::camino::Utf8PathBuf::into_std_path_buf),\n        );\n    }\n\n    let status = child.wait().context(\"Failed to wait for cargo build\")?;\n\n    if !status.success() {\n        bail!(\n            \"Cargo build failed. Set `[build] target = \\\"wasm32-unknown-unknown\\\"` (Astrid-canonical) or `wasm32-wasip2` in `.cargo/config.toml` and install the matching `rustup target` component.\"\n        );\n    }\n\n    artifacts.sort();\n    artifacts.dedup();\n    match artifacts.as_slice() {\n        [path] => Ok(CompiledWasm {\n            target,\n            path: path.clone(),\n        }),\n        [] => bail!(\n            \"Cargo completed without emitting the exact release cdylib artifact {expected_filename}\"\n        ),\n        _ => bail!(\n            \"Cargo emitted {} release cdylib artifacts named {expected_filename}; refusing to choose an ambiguous artifact\",\n            artifacts.len()\n        ),","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust.rs#L277-L313","documentation":"Error \"Cargo build failed. Set `[build] target = \"wasm32-unknown-unknown\"` (Astrid-canonical) or `wasm32-wasip2` in `.cargo/config.toml` and install the matching `rustup target` component.\" thrown in astrid-runtime/astrid.","triggerScenarios":"Thrown at crates/astrid-build/src/rust.rs:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set `[build] target = \"wasm32-unknown-unknown\"` (Astrid-canonical) or `wasm32-wasip2` in `.cargo/config.toml`","Install the matching target: `rustup target add wasm32-unknown-unknown`","Inspect the cargo stderr output above the message for the root compile error"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}