{"record":{"id":"6317cf8c38bebbf0","repo":"gitbutlerapp/gitbutler","slug":"no-id-found-for-entity","errorCode":null,"errorMessage":"No ID found for entity","messagePattern":"No ID found for entity","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/diff/mod.rs","lineNumber":25,"sourceCode":"    id::{CommitId, CommittedFileId},\n    utils::OutputChannel,\n    utils::change_source::ChangeSourceId,\n};\n\nmod display;\nmod show;\n\npub fn handle_tui(ctx: &mut Context, target_str: Option<&str>) -> anyhow::Result<()> {\n    use crate::tui::diff_viewer::{DiffFileEntry, WorktreeFilter};\n\n    let id_map = IdMap::legacy_new_from_context(ctx)?;\n\n    let files = if let Some(entity) = target_str {\n        let id = id_map\n            .parse_using_context(entity, ctx)?\n            .first()\n            .cloned()\n            .ok_or_else(|| anyhow::anyhow!(\"No ID found for entity\"))?;\n\n        match id {\n            CliId::UncommittedHunkOrFile(ref uncommitted_id) => {\n                let filter = WorktreeFilter::Uncommitted(Box::new(uncommitted_id.clone()));\n                DiffFileEntry::from_worktree(&id_map, Some(&filter))\n            }\n            CliId::PathPrefix { hunks, .. } => DiffFileEntry::from_hunks(&hunks),\n            CliId::Uncommitted { .. } => DiffFileEntry::from_worktree(\n                &id_map,\n                Some(&WorktreeFilter::Source(ChangeSourceId::Head)),\n            ),\n            CliId::Worktree { name, .. } => DiffFileEntry::from_worktree(\n                &id_map,\n                Some(&WorktreeFilter::Source(ChangeSourceId::Worktree(name))),\n            ),\n            CliId::Stack { .. } => DiffFileEntry::from_worktree(\n                &id_map,\n                Some(&WorktreeFilter::Source(ChangeSourceId::Head)),","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/diff/mod.rs#L7-L43","documentation":"handle_tui builds the TUI diff viewer from an optional target string: it runs IdMap::parse_using_context on the entity and takes the first parsed ID. This error fires when parsing succeeds but yields an empty list — the given string matches no known ID/hunk/path entity in the current ID map. (The TODO in the sibling handle() notes plain-name lookup and ambiguity handling are known gaps.)","triggerScenarios":"Launching the diff TUI with a stale or mistyped selector: `but diff tui abc123` where abc123 names no worktree hunk, path prefix, or branch/worktree in the current IdMap.","commonSituations":"Selector copied from an earlier session whose worktree changes were committed/discarded; using plain branch names that the parser doesn't resolve (per the TODO); abbreviations too short to match any entry.","solutions":["List valid IDs first with `but id` and retry with one of those exact/prefix selectors.","Prefer path-prefix selectors (a dirty file's path) which are stable across ID-map rebuilds.","Run without a target to open the whole worktree diff and navigate interactively."],"exampleFix":"# before\n$ but diff tui 4c\nError: No ID found for entity\n\n# after\n$ but id   # find a live ID\n$ but diff tui 4c1e","handlingStrategy":"validation","validationCode":"// Resolve the entity before launching the TUI\nlet id_map = IdMap::legacy_new_from_context(ctx)?;\nif let Some(entity) = target_str {\n    anyhow::ensure!(\n        !id_map.parse_using_context(entity, ctx)?.is_empty(),\n        \"'{entity}' matches no known change; run `but id` for valid selectors\"\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch selectors from `but id` in the same session as the diff command.","Prefer full file paths over short abbreviations in scripts."],"tags":["diff","tui","id-map","selector"],"backgroundTag":"unresolvable-id-selector","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}