{"record":{"id":"06744d3f1b8fd9f7","repo":"GitoxideLabs/gitoxide","slug":"a-captured-ref-does-not-logically-point-into-the-r","errorCode":null,"errorMessage":"a captured ref does not logically point into the rebase scope","messagePattern":"a captured ref does not logically point into the rebase scope","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":793,"sourceCode":"    repo.find_commit(state.base)\n        .context(\"could not find the recorded rebase base\")?;\n    repo.find_commit(state.onto)\n        .context(\"could not find the recorded rebase target\")?;\n    let scope: HashSet<_> = state.scope.iter().copied().collect();\n    let continuation_sources: HashSet<_> = state.continuation_sources.iter().copied().collect();\n    if scope.len() != state.scope.len() {\n        anyhow::bail!(\"the rebase state contains duplicate scope commits\");\n    }\n    if state.tips.iter().copied().collect::<HashSet<_>>().len() != state.tips.len() {\n        anyhow::bail!(\"the rebase state contains duplicate tips\");\n    }\n    let mut refs = HashSet::new();\n    for reference in &state.expected_refs {\n        if !refs.insert(reference.name.as_bstr()) {\n            anyhow::bail!(\"the rebase state contains duplicate refs\");\n        }\n        if !scope.contains(&reference.target) && reference.target != state.base && reference.target != state.onto {\n            anyhow::bail!(\"a captured ref does not logically point into the rebase scope\");\n        }\n    }\n    if let Some(name) = &state.head_ref\n        && !state\n            .expected_refs\n            .iter()\n            .any(|reference| reference.editable && reference.name == *name)\n    {\n        anyhow::bail!(\"the recorded HEAD ref is not editable\");\n    }\n    for tip in &state.tips {\n        repo.find_commit(*tip).context(\"could not find a recorded rebase tip\")?;\n    }\n    for id in &state.scope {\n        let commit = repo\n            .find_commit(*id)\n            .context(\"could not find a recorded scope commit\")?;\n        let parent = commit","sourceCodeStart":775,"sourceCodeEnd":811,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L775-L811","documentation":"During rebase state validation, each recorded expected ref must point to a commit that is either inside the captured rebase scope, the base commit, or the onto target. If a ref's target is none of these, the state file is logically inconsistent (e.g. corrupted or hand-edited) and tix refuses to restore the rebase. This prevents the rebase from moving refs to commits unrelated to the in-progress operation.","triggerScenarios":"Calling the todo/state parsing path (parse -> parse_state -> validate_state) on a persisted rebase state whose `expected_refs` contain a reference whose target commit is outside `state.scope`, `state.base`, and `state.onto`. Typically caused by manual editing of the state file, corruption, or stale state after history was rewritten externally.","commonSituations":"Hand-editing or script-mangling the tix rebase state file; resuming a rebase after a GC or reset removed and rewrote commits so recorded ref targets no longer match; copying rebase state between repositories.","solutions":["Delete the stale rebase state and restart the rebase so state is regenerated from real refs","Inspect the recorded expected_refs in the state file and correct ref targets to commits within the scope, base, or onto","Check that no concurrent git/tix operation (reset, rebase, GC) modified the refs captured by the in-progress rebase"],"exampleFix":"// before (hand-edited state)\nref main = 1a2b3c4... (commit outside scope)\n// after\nabandon the state (`tix` restart the rebase) so expected_refs are recaptured from actual refs","handlingStrategy":"validation","validationCode":"// before resuming, verify every expected ref target is in scope/base/onto\nfor reference in &state.expected_refs {\n    assert!(scope.contains(&reference.target)\n        || reference.target == state.base\n        || reference.target == state.onto,\n        \"ref {} points outside rebase scope\", reference.name);\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"does not logically point into the rebase scope\") => {\n        // discard state, prompt user to restart the rebase\n    }\n    r => r?,\n}","preventionTips":["Do not hand-edit tix rebase state files","Avoid running git reset/rebase/GC while a tix rebase is in progress","Restart the rebase rather than patching stale state"],"tags":["rebase","state-validation","git"],"backgroundTag":"invalid-state-transition","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"}