{"record":{"id":"349053f5a4657912","repo":"GitoxideLabs/gitoxide","slug":"the-rebase-state-contains-duplicate-tips","errorCode":null,"errorMessage":"the rebase state contains duplicate tips","messagePattern":"the rebase state contains duplicate tips","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":785,"sourceCode":"        resolved,\n        continuation_sources,\n    };\n    validate_state(repo, &state)?;\n    Ok(Some(state))\n}\n\nfn validate_state(repo: &gix::Repository, state: &State) -> Result<()> {\n    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    }","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L767-L803","documentation":"`validate_state` additionally checks the `tips` list for duplicates by collecting the OIDs into a temporary `HashSet` and comparing lengths. Repeated tip OIDs make the multi-tip rebase state ambiguous (the same tip would be processed twice), so the state is rejected.","triggerScenarios":"`parse_state` (via validate_state, gix-tix/src/edit/todo.rs:785) parses a state file where the same OID appears on two or more `tip <oid>` lines.","commonSituations":"Hand-edited tip lists; automation appending the same tip on retry; state files merged from concurrent worktree sessions.","solutions":["Remove duplicate `tip <oid>` lines so every tip is unique.","Regenerate the state file by restarting the operation.","Deduplicate tips in any tooling that constructs the state file."],"exampleFix":"// before (state file)\ntip 0123abc...\ntip 0123abc...\n// after\ntip 0123abc...","handlingStrategy":"validation","validationCode":"fn tip_lines_are_unique(text: &str) -> bool {\n    let ids: Vec<&str> = text.lines()\n        .filter_map(|l| l.strip_prefix(\"tip \"))\n        .collect();\n    ids.iter().collect::<std::collections::HashSet<_>>().len() == ids.len()\n}","typeGuard":null,"tryCatchPattern":"match todo::parse(state_text) {\n    Ok(state) => apply(state),\n    Err(e) if e.to_string().contains(\"duplicate tips\") => {\n        eprintln!(\"deduplicate tip lines before parsing\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Deduplicate tips when constructing the state, e.g. via a HashSet at write time.","On retry after a crash, re-derive tips from refs rather than re-appending.","Add a round-trip test that writes and re-parses generated state."],"tags":["rebase","state-validation","duplicate-entries","git"],"backgroundTag":"schema-validation-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}