astrid-runtime/astrid · error

Cargo configuration include cycle detected at

Error message

Cargo configuration include cycle detected at {}

What it means

Fired by CargoConfigLoader::load when an include chain re-enters a config file already being loaded (tracked by canonical path in the `active` set). Cargo config `include` directives form a cycle, so loading would recurse forever.

Solutions

  1. Break the include cycle in your `.cargo/config.toml` files
  2. Remove the self- or mutual `include` directive
  3. Restructure config layering so includes form a DAG
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    build_flags: Option<ParsedRustflags>,
    target_entries: Vec<(String, ParsedRustflags)>,
}

#[derive(Default)]
struct CargoConfigLoader {
    active: HashSet<PathBuf>,
}

impl CargoConfigLoader {
    fn load(&mut self, path: &Path, state: &mut CargoConfigState) -> Result<()> {
        let Some(content) = read_optional_config(path)? else {
            return Ok(());
        };
        let canonical = path
            .canonicalize()
            .with_context(|| format!("Failed to resolve Cargo configuration {}", path.display()))?;
        if !self.active.insert(canonical.clone()) {
            bail!(
                "Cargo configuration include cycle detected at {}",
                canonical.display()
            );
        }

        let result = self.load_content(&content, &canonical, state);
        self.active.remove(&canonical);
        result
    }

    fn load_content(
        &mut self,
        content: &str,
        path: &Path,
        state: &mut CargoConfigState,
    ) -> Result<()> {
        let doc = content
            .parse::<toml_edit::DocumentMut>()

View on GitHub (pinned to affd8760f4)