astrid-runtime/astrid · error

Capsule.toml component must be an array of tables

Error message

Capsule.toml component must be an array of tables

What it means

Fired by bind_manifest_to_packaged_wasm when the `component` key in Capsule.toml is present but is not an array of tables (e.g. a plain table or string). The manifest format only supports an array of component tables.

Solutions

  1. Rewrite `component` as an array of tables: `[[component]]` blocks
  2. Remove the malformed component key so the build regenerates it
  3. Validate Capsule.toml TOML syntax
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    toml_doc: &mut toml_edit::DocumentMut,
    packaged_name: &str,
) -> Result<()> {
    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"
        );
    }

View on GitHub (pinned to affd8760f4)