{"record":{"id":"f7808e87247a652c","repo":"gitbutlerapp/gitbutler","slug":"could-not-find-stack-containing-commit-commit-ref","errorCode":null,"errorMessage":"Could not find stack containing commit {commit_ref}","messagePattern":"Could not find stack containing commit (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/resolve.rs","lineNumber":239,"sourceCode":"            let traversal = head\n                .tip\n                .attach(&repo)\n                .ancestors()\n                .sorting(Sorting::BreadthFirst)\n                .all()?;\n\n            for info in traversal {\n                let info = info?;\n                if info.id == commit_gix_oid {\n                    found_stack_id = stack.id;\n                    break 'outer;\n                }\n            }\n        }\n    }\n\n    let stack_id = found_stack_id\n        .ok_or_else(|| anyhow::anyhow!(\"Could not find stack containing commit {commit_ref}\"))?;\n\n    drop(commit);\n    drop(repo);\n\n    // Enter edit mode\n    enter_edit_mode(ctx, commit_gix_oid, stack_id).context(\"Failed to enter edit mode\")?;\n\n    // Show checkout message\n    if let Some(out) = out.for_human() {\n        writeln!(\n            out,\n            \"{} {}\",\n            t.important.paint(\"Checking out conflicted commit\"),\n            commit_ref\n        )?;\n    }\n\n    // Now show the same status as `but resolve status` would show","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/resolve.rs#L221-L257","documentation":"`enter_resolution` in the resolve command is given a commit reference but could not locate any stack (workspace branch group) containing that commit, so `found_stack_id` stays None. The error tells the user the commit they referenced is not part of any current workspace stack.","triggerScenarios":"Calling `but resolve <commit-ref>` (directly or via check_and_prompt_for_conflicts) with a commit id/short id/branch ref that does not exist in the workspace's stacks — e.g. a fully merged commit, a typo'd short id, or a commit on a branch outside the workspace.","commonSituations":"Typing an abbreviated commit id that matches a commit not in any stack; referencing a commit after the stack was merged or archived; stale reference after workspace rebase/rebuild changed commit ids.","solutions":["Run `but log` / `but status` to list current stacks and copy the correct commit id","Confirm the commit still belongs to an active stack (it may have been merged or assigned to another branch)","Retry with the full commit id or an unambiguous reference","Re-open/refresh the workspace if commit ids changed after a rebase"],"exampleFix":"// before\nbut resolve ab12   # ambiguous or stale short id\n// error: Could not find stack containing commit ab12\n// after\nbut log            # find the commit inside an active stack\nbut resolve 3f9c1ab...","handlingStrategy":"validation","validationCode":"// verify the commit is in an active stack before resolving\nbut log | grep -q \"$(git rev-parse --short \"$COMMIT\")\" || { echo 'Commit not in any stack'; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! OUT=$(but resolve \"$COMMIT\" 2>&1); then\n  case \"$OUT\" in\n    *\"Could not find stack\"*) echo \"Commit $COMMIT is not in a stack; check 'but log' for current ids\";;\n    *) echo \"$OUT\";;\n  esac\nfi","preventionTips":["Copy commit ids from `but log` rather than typing short ids","Refresh your view after rebases — commit ids change","Only resolve commits that belong to active workspace stacks"],"tags":["cli","stack","commit-not-found","conflict-resolution"],"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"}