{"record":{"id":"4de78751220c6efe","repo":"gitbutlerapp/gitbutler","slug":"could-not-find-kind-cli-id-short-id-in-idmap","errorCode":null,"errorMessage":"Could not find {kind} CLI id '{short_id}' in IdMap","messagePattern":"Could not find (.+?) CLI id '(.+?)' in IdMap","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/status/mod.rs","lineNumber":1852,"sourceCode":"            ]),\n        )?;\n    }\n    Ok(())\n}\n\nfn lookup_cli_id_for_short_id(\n    id_map: &IdMap,\n    repo: &gix::Repository,\n    short_id: &str,\n    predicate: impl Fn(&CliId) -> bool,\n    kind: &str,\n) -> anyhow::Result<CliId> {\n    let mut matches = id_map.parse_using_repo(short_id, repo)?;\n    matches.retain(|id| id.to_short_string() == short_id && predicate(id));\n\n    match matches.len() {\n        1 => Ok(matches.remove(0)),\n        0 => Err(anyhow::anyhow!(\n            \"Could not find {kind} CLI id '{short_id}' in IdMap\"\n        )),\n        _ => Err(anyhow::anyhow!(\n            \"CLI id '{short_id}' is ambiguous for {kind} in IdMap\"\n        )),\n    }\n}\n\nfn status_letter(status: &TreeStatus) -> char {\n    match status {\n        TreeStatus::Addition { .. } => 'A',\n        TreeStatus::Deletion { .. } => 'D',\n        TreeStatus::Modification { .. } => 'M',\n        TreeStatus::Rename { .. } => 'R',\n    }\n}\n\npub fn status_letter_ui(status: &ui::TreeStatus) -> char {","sourceCodeStart":1834,"sourceCodeEnd":1870,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/status/mod.rs#L1834-L1870","documentation":"Thrown by `lookup_cli_id_for_short_id` (used by TUI/status commands): the short id string is parsed against the IdMap, matches are kept only if their canonical `to_short_string()` equals the input and they pass a kind predicate (e.g. commit vs branch). Zero surviving matches produces this error — the id is not registered for that kind.","triggerScenarios":"Passing a short id copied from stale `but status` output after ids shifted; a typo in the short id; passing a commit id where the command's predicate only accepts another kind, filtering out the real match.","commonSituations":"Piping ids between invocations across a rebase/amend/ship that renumbered them; reusing ids from a different workspace or project; scripts holding on to ids for too long.","solutions":["Rerun `but status` (or the list command for that kind) and copy a fresh short id","Double-check the id kind matches what the command expects (commit id for commit commands, branch id for branch commands)","Use the full-length git sha where the command accepts it — it bypasses short-id ambiguity and staleness","Retype the id carefully; a single wrong character makes the exact-string match fail"],"exampleFix":"# before: id from yesterday's output\nbut <cmd> c7\n\n# after: refresh and use current ids\nbut status\nbut <cmd> c4   # id as printed just now","handlingStrategy":"validation","validationCode":"let matches = id_map.parse_using_repo(short_id, repo)?;\nlet hits: Vec<_> = matches\n    .into_iter()\n    .filter(|id| id.to_short_string() == short_id && kind_predicate(id))\n    .collect();\nif hits.is_empty() {\n    anyhow::bail!(\"no {kind} id '{short_id}'; refresh with 'but status' and copy a current id\");\n}","typeGuard":null,"tryCatchPattern":"match lookup_cli_id_for_short_id(id_map, repo, short_id, |i| is_commit(i), \"commit\") {\n    Ok(cli_id) => { /* use */ }\n    Err(err) if err.to_string().contains(\"Could not find\") => {\n        // re-list ids and retry with a fresh one\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Always take ids from the latest `but status` output; never reuse them after amend/rebase/ship","Check that the id kind matches the command (commit id vs branch id)","Prefer full shas in long-running scripts to avoid stale short ids"],"tags":["rust","cli","tui","id-map","lookup","git"],"backgroundTag":"short-id-lookup-failed","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}