{"record":{"id":"df88b5321622a49e","repo":"astrid-runtime/astrid","slug":"no-capsule-toml-in-run-astrid-capsule-check","errorCode":null,"errorMessage":"no Capsule.toml in {} — run `astrid capsule check` from a capsule project directory (or pass its path)","messagePattern":"no Capsule\\.toml in (.+?) — run `astrid capsule check` from a capsule project directory \\(or pass its path\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/check.rs","lineNumber":75,"sourceCode":"struct Finding {\n    /// Short machine-readable rule id (shown in the report).\n    rule: &'static str,\n    /// Human-readable description, ending with the concrete fix.\n    message: String,\n}\n\n/// Entry point for `astrid capsule check [PATH]`. Returns a non-zero\n/// [`ExitCode`] when any problem is found, so it gates a CI job or pre-commit\n/// hook without extra glue.\npub(crate) fn run(path: Option<&str>) -> Result<ExitCode> {\n    let dir = match path {\n        Some(p) => PathBuf::from(p),\n        None => std::env::current_dir().context(\"resolving the current directory\")?,\n    };\n\n    let manifest_path = dir.join(\"Capsule.toml\");\n    if !manifest_path.exists() {\n        anyhow::bail!(\n            \"no Capsule.toml in {} — run `astrid capsule check` from a capsule project directory \\\n             (or pass its path)\",\n            dir.display()\n        );\n    }\n    let raw = std::fs::read_to_string(&manifest_path)\n        .with_context(|| format!(\"reading {}\", manifest_path.display()))?;\n    let manifest: CapsuleManifest =\n        toml::from_str(&raw).with_context(|| format!(\"parsing {}\", manifest_path.display()))?;\n\n    let tool_names = scan_tool_annotations(&dir.join(\"src\"))?;\n    let interceptors = manifest.effective_interceptors();\n    let publishes = manifest.effective_ipc_publish_patterns();\n\n    let findings = check_capsule(&tool_names, &interceptors, &publishes);\n\n    print_report(tool_names.len(), &findings);\n    Ok(if findings.is_empty() {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/check.rs#L57-L93","documentation":"`astrid capsule check` resolves the target directory (from `--path` or the current working directory) and requires a `Capsule.toml` manifest there. If the file does not exist, it bails with this message telling you where it looked and how to fix it. It is a pre-flight guard so the checker never parses a nonexistent manifest.","triggerScenarios":"Running `astrid capsule check` from a directory without `Capsule.toml` and without passing a project path; passing a `--path` that points to the wrong directory (parent, subdirectory, or an unrelated folder).","commonSituations":"Running the command from a repo root instead of the capsule subdirectory; a typo in the path argument; the manifest renamed or deleted; CI checking out only part of the project.","solutions":["cd into the capsule project directory that contains Capsule.toml and re-run.","Pass the capsule directory explicitly: `astrid capsule check path/to/capsule`.","Verify the file exists: `ls Capsule.toml` (or `ls <path>/Capsule.toml`).","If the manifest was renamed/deleted, restore it from version control."],"exampleFix":"// before (run from repo root)\nastrid capsule check\n// after\nastrid capsule check crates/my-capsule","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn ensure_capsule_dir(dir: &Path) -> std::io::Result<()> {\n    if !dir.join(\"Capsule.toml\").exists() {\n        return Err(std::io::Error::new(\n            std::io::ErrorKind::NotFound,\n            format!(\"{} has no Capsule.toml\", dir.display()),\n        ));\n    }\n    Ok(())\n}","typeGuard":"fn is_capsule_dir(p: &std::path::Path) -> bool { p.is_dir() && p.join(\"Capsule.toml\").is_file() }","tryCatchPattern":"match run_capsule_check(path) {\n    Ok(report) => println!(\"{}\", report),\n    Err(e) if e.to_string().contains(\"no Capsule.toml\") =>\n        eprintln!(\"Not a capsule project: {}. Pass a path containing Capsule.toml.\", path.display()),\n    Err(e) => eprintln!(\"capsule check failed: {e:#}\"),\n}","preventionTips":["Run capsule commands from the directory containing Capsule.toml, or always pass an explicit path.","Check `ls Capsule.toml` before scripting the command in CI.","Never rename or delete Capsule.toml without updating scripts.","In CI, verify the checkout includes the capsule subdirectory."],"tags":["filesystem","manifest","cli","working-directory"],"backgroundTag":"file-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}