{"record":{"id":"21beb11f9dc536d0","repo":"GitoxideLabs/gitoxide","slug":"checked-above","errorCode":null,"errorMessage":"checked above","messagePattern":"checked above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/rebase.rs","lineNumber":2219,"sourceCode":"                transition.new,\n            )?;\n        }\n        let head = self.repo.head()?;\n        let unborn = head.is_unborn();\n        let current_ref = head.referent_name().map(ToOwned::to_owned);\n        let mut deferred_ref_deletions = Vec::new();\n        if let (Some(expected_refs), Some(current_ref)) = (&mut self.expected_refs, current_ref) {\n            if expected_refs\n                .iter()\n                .any(|expected| expected.name == current_ref && expected.old.is_some() && expected.new.is_none())\n                && (self.repo.workdir().is_none() || (self.selected.is_none() && !self.checkout_after_finish))\n            {\n                anyhow::bail!(\"cannot delete the checked-out branch without selecting another checkout\");\n            }\n            expected_refs.retain(|expected| {\n                let defer = expected.name == current_ref && expected.old.is_some() && expected.new.is_none();\n                if defer {\n                    deferred_ref_deletions.push((expected.name.clone(), expected.old.expect(\"checked above\")));\n                }\n                !defer\n            });\n        }\n        let updated_refs = update_refs(\n            &self.repo,\n            &self.rewritten,\n            unborn,\n            self.selected,\n            &self.committer,\n            self.expected_refs.take(),\n            (&self.pins, &self.delete_refs),\n            resource_edits,\n        )?;\n        for (transitioned, transition) in transitions.iter().enumerate() {\n            if let Err(err) = super::forget::apply_tree_transition(&transition.workdir, transition.old, transition.new)\n            {\n                return rollback(","sourceCodeStart":2201,"sourceCodeEnd":2237,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/rebase.rs#L2201-L2237","documentation":"Panic from `.expect(\"checked above\")` when processing deferred ref deletions during branch updates in gix-tix rebase. The enclosing code just matched `expected.old.is_some()` in the `defer` condition, so the expect asserts the retained value is still `Some`. It can only fire if `expected.old` was somehow mutated or the retain predicate logic changed — i.e. an internal invariant, not a user-triggerable error.","triggerScenarios":"Calling an update/finish operation that deletes the currently checked-out branch; the panic only occurs on a code defect where the `defer` condition and the `expect` disagree about `expected.old`.","commonSituations":"Attempting to delete the checked-out branch as part of a rebase update while selecting another checkout; normally this path works and errors earlier with 'cannot delete the checked-out branch...'.","solutions":["Verify the library version; upgrade gix-tix if this panic is reachable, as it indicates a broken invariant.","Wrap the operation in `catch_unwind` only as a last resort; prefer reproducing and reporting the bug.","Ensure ref-update expectations come from the library's own computation, not hand-built values with missing `old` targets."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if expected.name == current_ref && expected.old.is_none() {\n    return Err(anyhow::anyhow!(\"cannot defer deletion of ref without known old value\"));\n}","typeGuard":"fn is_deferable(e: &ExpectedRef) -> bool {\n    e.name == current_ref && e.old.is_some() && e.new.is_none()\n}","tryCatchPattern":"let out = std::panic::catch_unwind(AssertUnwindSafe(|| update_refs(...)));\nif out.is_err() { anyhow::bail!(\"ref update panicked; report a gix-tix bug\"); }","preventionTips":["Use only library-computed ref expectations","Avoid deleting the checked-out branch without selecting a replacement checkout","Upgrade gix-tix if this panic is reachable in your version"],"tags":["rust","panic","internal-invariant","git-refs"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}