astrid-runtime/astrid · error

Cargo include must be a string, array, or table in

Error message

Cargo include must be a string, array, or table in {}

What it means

Type-dispatch fallback in cargo_config_includes: the Cargo include item in the config file is not a string, not an array, and not a table — the three supported shapes. Reached when e.g. an include is declared as an integer or boolean. The error names the offending config file so the user can fix the TOML type.

Solutions

  1. Add `path = "other-config.toml"` to the include table
  2. Or use the plain string include form
  3. Fix the config file syntax and retry
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

            .and_then(toml_edit::Item::as_str)
            .ok_or_else(|| {
                anyhow::anyhow!(
                    "Cargo include table must contain a string path in {}",
                    path.display()
                )
            })?;
        let optional = match table.get("optional") {
            None => false,
            Some(value) => value.as_bool().ok_or_else(|| {
                anyhow::anyhow!(
                    "Cargo include optional must be a boolean in {}",
                    path.display()
                )
            })?,
        };
        return Ok(vec![resolve_cargo_config_include(path, include, optional)?]);
    }
    bail!(
        "Cargo include must be a string, array, or table in {}",
        path.display()
    )
}

fn resolve_cargo_config_include(
    including_file: &Path,
    include: &str,
    optional: bool,
) -> Result<Option<PathBuf>> {
    if include.is_empty() {
        bail!("Cargo include path cannot be empty");
    }
    let parent = including_file
        .parent()
        .context("Cargo configuration file has no parent directory")?;
    let candidate = parent.join(include);
    let resolved = match candidate.canonicalize() {

View on GitHub (pinned to affd8760f4)