nikivdev/code · error
'codanna init' exited with status {}
Error message
'codanna init' exited with status {} What it means
ensure_codanna_initialized spawns the external `codanna init` command as a subprocess. If the process exits with a non-zero status (after successfully spawning), the tool wraps that exit code into this anyhow error. It indicates codanna's own initialization step failed, not a spawn failure.
Source
Thrown at src/indexer.rs:64
let settings = project_root.join(".codanna/settings.toml");
if settings.exists() {
return Ok(());
}
println!(
"No Codanna settings found at {} – running 'codanna init'.",
settings.display()
);
let status = Command::new(binary)
.arg("init")
.current_dir(project_root)
.status()
.with_context(|| "failed to spawn 'codanna init'")?;
if status.success() {
Ok(())
} else {
bail!(
"'codanna init' exited with status {}",
status.code().unwrap_or(-1)
);
}
}
fn run_codanna_index(binary: &Path, project_root: &Path) -> Result<()> {
println!("Indexing project {} via Codanna...", project_root.display());
let status = Command::new(binary)
.arg("index")
.arg("--progress")
.arg(".")
.current_dir(project_root)
.status()
.with_context(|| "failed to spawn 'codanna index'")?;
if status.success() {
Ok(())View on GitHub (pinned to a747e741ae)
Solutions
- Run `codanna init` manually in the project root and read its stderr output to see the underlying failure.
- Check `codanna --version` and upgrade/reinstall codanna if it is outdated or broken.
- Fix any codanna configuration issues (invalid config file, missing permissions) reported by manual init.
- Verify the `codanna` binary resolved on PATH is the intended one (`which codanna`).
Defensive patterns
Strategy: try-catch
Validate before calling
if which::which("codanna").is_err() {
eprintln!("codanna not found on PATH; install it first");
}
let ok = std::process::Command::new("codanna")
.arg("--version")
.status()
.map(|s| s.success())
.unwrap_or(false);
if !ok { eprintln!("codanna is broken or too old"); } Try / catch
match run_indexer() {
Ok(stats) => handle(stats),
Err(e) if e.to_string().contains("'codanna init' exited") => {
eprintln!("codanna init failed; run `codanna init` manually to see stderr");
}
Err(e) => return Err(e),
} Prevention
- Install and verify codanna (`codanna --version`) before running the indexer
- Run `codanna init` once manually per project and commit the resulting config
- Keep codanna up to date to avoid subcommand/behavior drift
When it happens
Trigger: Running the indexer's run() flow when `codanna init` is not properly installed/configured, has a broken config, or otherwise returns a non-zero exit code.
Common situations: codanna is installed but its config file is invalid; a PATH-resolved `codanna` shim is an old incompatible version; codanna init fails due to permissions in the target directory.
Related errors
- 'codanna index' exited with status {}
- 'codanna mcp get_index_info' failed: {}
- Lin.app is not running
- gen agent list failed
- gen agent list failed: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/f6f54a7fa1abd0a6.
Report an issue: GitHub.