astrid-runtime/astrid · error

Capsule.toml component

Error message

Capsule.toml component `{key}` must be a string

What it means

Type validation in bind_manifest_to_packaged_wasm: after choosing `file` or `entrypoint` as the executable-path key, the corresponding TOML value exists but is not a string (e.g. a number, boolean, or table). The component's executable path must be a string so it can be rewritten to the packaged .wasm name; any other TOML type is rejected.

Solutions

  1. Quote the value: `file = "name.wasm"`
  2. Fix the TOML type (numbers/booleans/arrays are not valid here)
  3. Rebuild after correcting Capsule.toml
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    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 {
        "entrypoint"
    } else {
        "file"
    };
    if let Some(item) = component.get(key)
        && item.as_str().is_none()
    {
        bail!("Capsule.toml component `{key}` must be a string")
    }
    component.insert(key, toml_edit::value(packaged_name));
    Ok(())
}

/// Resolve the output directory, creating it if necessary.
fn resolve_output_dir(output: Option<&str>) -> Result<PathBuf> {
    let out_dir = match output {
        Some(p) => PathBuf::from(p),
        None => std::env::current_dir()?.join("dist"),
    };
    if !out_dir.exists() {
        fs::create_dir_all(&out_dir)?;
    }
    Ok(out_dir)
}

/// Stage a `wit/` directory for inclusion in the capsule archive.

View on GitHub (pinned to affd8760f4)