astrid-runtime/astrid · error
no Capsule.toml in {} — run `astrid capsule check` from a ca
Error message
no Capsule.toml in {} — run `astrid capsule check` from a capsule project directory (or pass its path) What it means
`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.
Source
Thrown at crates/astrid-cli/src/commands/capsule/check.rs:75
struct Finding {
/// Short machine-readable rule id (shown in the report).
rule: &'static str,
/// Human-readable description, ending with the concrete fix.
message: String,
}
/// Entry point for `astrid capsule check [PATH]`. Returns a non-zero
/// [`ExitCode`] when any problem is found, so it gates a CI job or pre-commit
/// hook without extra glue.
pub(crate) fn run(path: Option<&str>) -> Result<ExitCode> {
let dir = match path {
Some(p) => PathBuf::from(p),
None => std::env::current_dir().context("resolving the current directory")?,
};
let manifest_path = dir.join("Capsule.toml");
if !manifest_path.exists() {
anyhow::bail!(
"no Capsule.toml in {} — run `astrid capsule check` from a capsule project directory \
(or pass its path)",
dir.display()
);
}
let raw = std::fs::read_to_string(&manifest_path)
.with_context(|| format!("reading {}", manifest_path.display()))?;
let manifest: CapsuleManifest =
toml::from_str(&raw).with_context(|| format!("parsing {}", manifest_path.display()))?;
let tool_names = scan_tool_annotations(&dir.join("src"))?;
let interceptors = manifest.effective_interceptors();
let publishes = manifest.effective_ipc_publish_patterns();
let findings = check_capsule(&tool_names, &interceptors, &publishes);
print_report(tool_names.len(), &findings);
Ok(if findings.is_empty() {View on GitHub (pinned to affd8760f4)
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.
Example fix
// before (run from repo root) astrid capsule check // after astrid capsule check crates/my-capsule
Defensive patterns
Strategy: validation
Validate before calling
use std::path::Path;
fn ensure_capsule_dir(dir: &Path) -> std::io::Result<()> {
if !dir.join("Capsule.toml").exists() {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
format!("{} has no Capsule.toml", dir.display()),
));
}
Ok(())
} Type guard
fn is_capsule_dir(p: &std::path::Path) -> bool { p.is_dir() && p.join("Capsule.toml").is_file() } Try / catch
match run_capsule_check(path) {
Ok(report) => println!("{}", report),
Err(e) if e.to_string().contains("no Capsule.toml") =>
eprintln!("Not a capsule project: {}. Pass a path containing Capsule.toml.", path.display()),
Err(e) => eprintln!("capsule check failed: {e:#}"),
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Source path does not exist: {source}
- source path does not exist: {source}
- Capsule '{name}' is not installed.
- local capsule source {source:?} is not a regular file
- {} contains no Distro.toml
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/df88b5321622a49e.
Report an issue: GitHub.