astrid-runtime/astrid · error

Capsule.toml declares

Error message

Capsule.toml declares {} components, but this build packages exactly one cdylib

What it means

Fired by bind_manifest_to_packaged_wasm when Capsule.toml lists a number of components other than one, but this build packages exactly a single cdylib. The manifest would describe components that do not exist in the archive.

Solutions

  1. Trim Capsule.toml to exactly one `[[component]]` entry
  2. Remove the component section entirely so the build writes a default one
  3. Split the build if you genuinely need multi-component capsules
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/astrid-build/src/rust.rs:736 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/be61916a6770f258. Report an issue: GitHub.

Appendix: source

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

    validate_wasm_output_name(packaged_name.strip_suffix(".wasm").unwrap_or(packaged_name))?;

    let Some(component_item) = toml_doc.get_mut("component") else {
        let mut component = toml_edit::Table::new();
        let component_id = packaged_name.strip_suffix(".wasm").unwrap_or(packaged_name);
        component.insert("id", toml_edit::value(component_id));
        component.insert("file", toml_edit::value(packaged_name));
        component.insert("type", toml_edit::value("executable"));
        let mut components = toml_edit::ArrayOfTables::new();
        components.push(component);
        toml_doc.insert("component", toml_edit::Item::ArrayOfTables(components));
        return Ok(());
    };

    let Some(components) = component_item.as_array_of_tables_mut() else {
        bail!("Capsule.toml component must be an array of tables")
    };
    if components.len() != 1 {
        bail!(
            "Capsule.toml declares {} components, but this build packages exactly one cdylib",
            components.len()
        );
    }
    let component = components
        .get_mut(0)
        .context("Capsule.toml component array unexpectedly empty")?;
    let has_file = component.get("file").is_some();
    let has_entrypoint = component.get("entrypoint").is_some();
    if has_file && has_entrypoint {
        bail!(
            "Capsule.toml component declares both `file` and `entrypoint`; refusing an ambiguous executable path"
        );
    }

    let key = if has_file {
        "file"
    } else if has_entrypoint {

View on GitHub (pinned to affd8760f4)