astrid-runtime/astrid · error

Could not automatically detect the project type. Please…

Error message

Could not automatically detect the project type. Please ensure a Cargo.toml, gemini-extension.json, package.json, or Capsule.toml exists in the directory, or use the --type flag.

What it means

Error "Could not automatically detect the project type. Please ensure a Cargo.toml, gemini-extension.json, package.json, or Capsule.toml exists in the directory, or use the --type flag." thrown in astrid-runtime/astrid.

Solutions

  1. cd into the directory containing Cargo.toml, gemini-extension.json, package.json, mcp.json, or Capsule.toml
  2. Create the appropriate manifest file for your project type
  3. Pass the project type explicitly with `--type`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/astrid-build/src/build.rs:83 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/351a794da53c03f7. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-build/src/build.rs:83

    }

    if dir.join("gemini-extension.json").exists() {
        return Ok("extension".to_string());
    }

    if dir.join("package.json").exists() {
        return Ok("js".to_string());
    }

    if dir.join("mcp.json").exists() {
        return Ok("mcp".to_string());
    }

    if dir.join("Capsule.toml").exists() {
        return Ok("static".to_string());
    }

    bail!(
        "Could not automatically detect the project type. \
         Please ensure a Cargo.toml, gemini-extension.json, \
         package.json, or Capsule.toml exists in the directory, or use the --type flag."
    );
}

#[cfg(test)]
mod tests {
    use crate::archiver::pack_capsule_archive;
    use std::fs;
    use std::path::Path;

    /// Unpack a .capsule archive into a directory (mirrors install.rs logic).
    fn unpack_capsule(archive_path: &Path, dest: &Path) {
        let tar_gz = fs::File::open(archive_path).unwrap();
        let decoder = flate2::read::GzDecoder::new(tar_gz);
        let mut archive = tar::Archive::new(decoder);

View on GitHub (pinned to affd8760f4)