nikivdev/code · error
'codanna mcp get_index_info' failed: {}
Error message
'codanna mcp get_index_info' failed: {} What it means
capture_index_stats runs `codanna mcp get_index_info --json` and captures its output. If the command exits non-zero, its trimmed stderr is embedded in this bail! error. The stderr content after the colon is codanna's own diagnostic, so this error is a wrapper around whatever codanna reported.
Source
Thrown at src/indexer.rs:103
"'codanna index' exited with status {}",
status.code().unwrap_or(-1)
);
}
}
fn capture_index_stats(binary: &Path, project_root: &Path) -> Result<String> {
println!("Fetching Codanna index metadata...");
let output = Command::new(binary)
.arg("mcp")
.arg("get_index_info")
.arg("--json")
.current_dir(project_root)
.output()
.with_context(|| "failed to run 'codanna mcp get_index_info --json'")?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
bail!("'codanna mcp get_index_info' failed: {}", stderr.trim());
}
let json: serde_json::Value = serde_json::from_slice(&output.stdout)
.with_context(|| "failed to parse JSON from 'codanna mcp get_index_info --json'")?;
serde_json::to_string_pretty(&json).with_context(|| "failed to serialize Codanna stats payload")
}
fn persist_snapshot(
project_root: &Path,
binary: &Path,
payload: &str,
override_path: Option<PathBuf>,
) -> Result<PathBuf> {
let db_path = override_path.unwrap_or_else(default_db_path);
if let Some(parent) = db_path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create directory {}", parent.display()))?;View on GitHub (pinned to a747e741ae)
Solutions
- Read the stderr text in the error message — it contains codanna's actual diagnostic.
- Verify your codanna version supports `codanna mcp get_index_info --json` by running it manually; upgrade if the subcommand is unknown.
- Ensure `codanna init` and `codanna index` succeeded before capturing stats.
- Run the command in the project root manually to reproduce and debug.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the subcommand exists on this codanna version
let probe = std::process::Command::new("codanna")
.args(["mcp", "get_index_info", "--json"])
.output()?;
if !probe.status.success() {
eprintln!("get_index_info unsupported/failing: {}",
String::from_utf8_lossy(&probe.stderr));
} Try / catch
match run_indexer() {
Ok(stats) => handle(stats),
Err(e) if e.to_string().contains("get_index_info' failed") => {
// stderr after the colon is codanna's own diagnostic
eprintln!("stats capture failed: {e}; check codanna version supports mcp get_index_info");
}
Err(e) => return Err(e),
} Prevention
- Pin/upgrade codanna to a version that supports `mcp get_index_info --json`
- Complete init and index steps before capturing stats
- Surface the embedded stderr (text after the colon) when triaging
When it happens
Trigger: Running the indexer's stats capture step when `codanna mcp get_index_info --json` fails: unknown subcommand in old codanna versions, uninitialized index, or codanna runtime error.
Common situations: Installed codanna version predates the `mcp get_index_info` subcommand; index missing because `codanna index` never ran or failed; codanna crashes while reading index metadata.
Related errors
- 'codanna init' exited with status {}
- 'codanna index' exited with status {}
- 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/cf8f97aca083f23a.
Report an issue: GitHub.