{"record":{"id":"3e3dd2ac564380ea","repo":"gitbutlerapp/gitbutler","slug":"raw-id-no-found","errorCode":null,"errorMessage":"'{raw_id}' no found","messagePattern":"'(.+?)' no found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/utils/diff_rendering.rs","lineNumber":1406,"sourceCode":"\nfn filter_uncommitted_hunks<'a, F>(\n    ctx: &'a Context,\n    id_map: &'a IdMap,\n    mut filter: F,\n) -> anyhow::Result<Vec<(&'a str, Arc<CliId>, &'a UncommittedHunk)>>\nwhere\n    F: FnMut(&UncommittedHunk) -> bool,\n{\n    let mut uncommitted_hunks = id_map\n        .uncommitted_hunks\n        .iter()\n        .filter(move |(_, hunk)| filter(hunk))\n        .map(|(raw_id, hunk)| {\n            let mut cli_ids = id_map.parse_using_context(raw_id, ctx)?;\n            if cli_ids.len() == 1 {\n                Ok((&**raw_id, Arc::new(cli_ids.remove(0)), hunk))\n            } else if cli_ids.is_empty() {\n                bail!(\"'{raw_id}' no found\")\n            } else {\n                bail!(\n                    \"'{raw_id}' resolved to more than one hunk ({})\",\n                    cli_ids.len()\n                )\n            }\n        })\n        .collect::<anyhow::Result<Vec<_>>>()?;\n\n    uncommitted_hunks.sort_by(|(id_a, _, hunk_a), (id_b, _, hunk_b)| {\n        (\n            &hunk_a.hunk.path,\n            hunk_a\n                .hunk\n                .hunk_header\n                .as_ref()\n                .map(|header| header.old_start),\n            id_a,","sourceCodeStart":1388,"sourceCodeEnd":1424,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/utils/diff_rendering.rs#L1388-L1424","documentation":"When rendering hunks, each raw hunk id is parsed against the context; the mapping must resolve to exactly one hunk. If it resolves to zero, the code bails with \"'<raw_id>' no found\" (a typo for 'not found'). This means the given id no longer matches any hunk in the current diff state.","triggerScenarios":"Passing a hunk id that the IdMap cannot resolve: the hunk was edited/committed/staged since the id was captured, the id is stale from a previous `but` output, or it was mistyped.","commonSituations":"Scripting against `but` output ids after the working tree changed; reusing ids from an old status listing; typos in hunk ids; concurrently modifying files while constructing the command.","solutions":["Re-run the listing command (e.g. `but status`) to get fresh hunk ids and use those.","Verify the id spelling — the message quotes exactly what failed to resolve.","Refresh workspace state (the id map is context-dependent) and retry once the tree is stable."],"exampleFix":"// before (stale id from earlier output)\nbut unapply hunk_a1b2\n// after\nbut status            # capture current hunk ids\nbut unapply <current-hunk-id>","handlingStrategy":"retry","validationCode":"# refresh ids before use; never reuse ids from stale output\nfresh_ids=$(but status --json | jq -r '.hunks[].id')\necho \"$fresh_ids\" | grep -qx \"$HUNK_ID\" || { echo \"stale id\"; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! but apply \"$HUNK_ID\" 2>/dev/null; then\n  HUNK_ID=$(but status --json | jq -r '.hunks[].id' | head -1)\n  but apply \"$HUNK_ID\"\nfi","preventionTips":["Re-fetch hunk ids immediately before each scripted command","Never cache but output ids across tree modifications","Copy ids exactly from current output (avoid typos)"],"tags":["cli","stale-identifier","git","hunk-lookup"],"backgroundTag":"record-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}