astrid-runtime/astrid · error
Cargo reported compiled WASM at
Error message
Cargo reported compiled WASM at {}, but the exact release artifact is {} What it means
Fired by build when Cargo metadata resolved a package id but none of its compiled release artifacts exactly matches the resolved cdylib output name. Cargo built something else than expected, so packaging would grab the wrong WASM.
Solutions
- Declare exactly one cdylib target with the expected output name in Cargo.toml
- Clean `target/` and rebuild to remove stale artifacts
- Set an explicit `[lib] name` matching the packaged component
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/astrid-build/src/rust.rs:64 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/bb3ce875d120d1a3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-build/src/rust.rs:64
/// Build a Rust capsule from a crate directory.
///
/// 1. `cargo build --release` using Cargo's resolved target/configuration
/// 2. Extract capsule description via Extism (`astrid_export_schemas`)
/// 3. Merge description into `Capsule.toml`
/// 4. Pack into `.capsule` archive
pub(crate) fn build(dir: &Path, output: Option<&str>) -> Result<()> {
info!("Building Rust WASM capsule from {}", dir.display());
verify_cargo_available()?;
let (meta, crate_name, package_version, wasm_name, package_id) = resolve_package_metadata(dir)?;
let compiled = compile_wasm(dir, &package_id, &wasm_name)?;
let wasm_path = locate_wasm_binary(&meta, &compiled.target, &wasm_name)?;
if wasm_path != compiled.path {
bail!(
"Cargo reported compiled WASM at {}, but the exact release artifact is {}",
compiled.path.display(),
wasm_path.display()
);
}
let wasm_path = ensure_component(&wasm_path)?;
let toml_content =
build_manifest_content(dir, &wasm_path, &crate_name, &package_version, &wasm_name)?;
let assets = discover_opaque_assets(dir)?;
let asset_refs: Vec<&Path> = assets.iter().map(PathBuf::as_path).collect();
let out_dir = resolve_output_dir(output)?;
let out_file = out_dir.join(format!("{crate_name}.capsule"));
// Stage the wit/ directory — merges the capsule's own wit/ (if any) with
// the astrid-sdk shared contracts as a WIT dependency so capsule authors
// can reference shared records via `wit_type` without duplication.View on GitHub (pinned to affd8760f4)