{"record":{"id":"84085d32985a81d4","repo":"GitoxideLabs/gitoxide","slug":"the-undo-queue-has-only-one-of-its-tip-and-cursor","errorCode":null,"errorMessage":"the undo queue has only one of its tip and cursor references","messagePattern":"the undo queue has only one of its tip and cursor references","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/undo.rs","lineNumber":768,"sourceCode":"    fn position(&self, cursor_index: usize) -> Position {\n        Position {\n            title: cursor_index\n                .checked_sub(1)\n                .and_then(|index| self.entries.get(index))\n                .map_or_else(|| START_TITLE.into(), |entry| entry.title.clone()),\n            undo: cursor_index,\n            redo: self.entries.len() - cursor_index,\n        }\n    }\n}\n\nfn load(repo: &gix::Repository) -> Result<Option<Queue>> {\n    let tip = read_queue_ref(repo, TIP_REF)?;\n    let cursor = read_queue_ref(repo, CURSOR_REF)?;\n    let (tip, cursor) = match (tip, cursor) {\n        (None, None) => return Ok(None),\n        (Some(tip), Some(cursor)) => (tip, cursor),\n        _ => bail!(\"the undo queue has only one of its tip and cursor references\"),\n    };\n\n    let mut id = tip;\n    let mut seen = HashSet::new();\n    let mut entries = Vec::new();\n    let sentinel;\n    loop {\n        ensure!(seen.insert(id), \"the undo queue first-parent chain contains a cycle\");\n        let stored = parse_commit(repo, id)?;\n        match stored.parent {\n            Some(parent) => {\n                entries.push(StoredEntry {\n                    id,\n                    title: stored.title,\n                    changes: stored.changes,\n                });\n                id = parent;\n            }","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/undo.rs#L750-L786","documentation":"Integrity check in `edit::undo::load`, which restores the undo queue from its TIP and CURSOR references. The queue is only valid when both refs exist together or neither does; if exactly one of the pair is present, the queue is in an inconsistent state (partial write, manual deletion, or corruption) and loading bails instead of planning undo/redo against incomplete data. This error propagates to callers `record`, `position`, `plan_undo`, and `plan_redo`. Fix by restoring the missing ref or clearing both refs to reset the queue.","triggerScenarios":"Thrown at gix-tix/src/edit/undo.rs:768 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore the missing queue reference: recreate refs/tix/undo/tip or refs/tix/undo/cursor from a backup or by re-deriving it from the other reference","Delete the surviving queue reference as well so load() sees neither and the undo queue restarts empty","Fix whatever partial write or external deletion left the pair inconsistent, then retry the undo/redo operation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}