astrid-runtime/astrid · error

Cargo build failed. Set `[build] target =…

Error message

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.

What it means

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.

Solutions

  1. Set `[build] target = "wasm32-unknown-unknown"` (Astrid-canonical) or `wasm32-wasip2` in `.cargo/config.toml`
  2. Install the matching target: `rustup target add wasm32-unknown-unknown`
  3. Inspect the cargo stderr output above the message for the root compile error
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/astrid-build/src/rust.rs:295 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/4347478e9960fd16. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-build/src/rust.rs:295

        {
            continue;
        }
        artifacts.extend(
            artifact
                .filenames
                .into_iter()
                .filter(|path| {
                    path.file_name()
                        .is_some_and(|name| name == expected_filename)
                })
                .map(cargo_metadata::camino::Utf8PathBuf::into_std_path_buf),
        );
    }

    let status = child.wait().context("Failed to wait for cargo build")?;

    if !status.success() {
        bail!(
            "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."
        );
    }

    artifacts.sort();
    artifacts.dedup();
    match artifacts.as_slice() {
        [path] => Ok(CompiledWasm {
            target,
            path: path.clone(),
        }),
        [] => bail!(
            "Cargo completed without emitting the exact release cdylib artifact {expected_filename}"
        ),
        _ => bail!(
            "Cargo emitted {} release cdylib artifacts named {expected_filename}; refusing to choose an ambiguous artifact",
            artifacts.len()
        ),

View on GitHub (pinned to affd8760f4)