astrid-runtime/astrid · error
Cargo emitted release cdylib artifacts named ; refusing to…
Error message
Cargo emitted {} release cdylib artifacts named {expected_filename}; refusing to choose an ambiguous artifact What it means
Fired by compile_wasm_with_target when cargo emits multiple distinct release artifacts with the same expected cdylib filename (e.g. from multiple builds/compilers), so the correct WASM cannot be chosen unambiguously.
Solutions
- Clean the target directory (`cargo clean`) and rebuild
- Avoid building the same cdylib with multiple configurations into one target dir
- Use distinct target directories per configuration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/astrid-build/src/rust.rs:310 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/8cbd721c9988a998.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-build/src/rust.rs:310
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()
),
}
}
fn inject_getrandom_for_target(target: &str) -> bool {
target == GETRANDOM_TARGET
}
/// Append the custom getrandom cfg without replacing any effective Cargo
/// rustflags. Cargo's precedence is encoded-rustflags env, plain rustflags env,
/// target-specific rustflags env, matching target config, then build
/// rustflags. We modify only the first effective environment source. When
/// config-derived flags are effective (including when `CARGO_BUILD_RUSTFLAGS`
/// is shadowed by matching target entries), a Cargo config override preserves
/// Cargo's own hierarchy and reaches every dependency.
fn append_getrandom_rustflag(View on GitHub (pinned to affd8760f4)