{"record":{"id":"8c50610b75e860a5","repo":"GitoxideLabs/gitoxide","slug":"the-rebase-state-has-more-than-one-onto-target","errorCode":null,"errorMessage":"the rebase state has more than one onto target","messagePattern":"the rebase state has more than one onto target","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":690,"sourceCode":"    let mut scope = Vec::new();\n    let mut marker_required = None;\n    let mut checkout_allowed = None;\n    let mut head_ref = None;\n    let mut edit_refs = false;\n    let mut expected_refs = Vec::new();\n    let mut resolved = None;\n    let mut continuation_sources = Vec::new();\n    for line in body[..end].lines() {\n        let (key, value) = line.split_once(' ').context(\"a rebase state line has no value\")?;\n        match key {\n            \"base\" => {\n                if base.replace(ObjectId::from_hex(value.as_bytes())?).is_some() {\n                    anyhow::bail!(\"the rebase state has more than one base\");\n                }\n            }\n            \"onto\" => {\n                if onto.replace(ObjectId::from_hex(value.as_bytes())?).is_some() {\n                    anyhow::bail!(\"the rebase state has more than one onto target\");\n                }\n            }\n            \"tip\" => tips.push(ObjectId::from_hex(value.as_bytes())?),\n            \"scope\" => scope.push(ObjectId::from_hex(value.as_bytes())?),\n            \"marker-required\" => {\n                if marker_required.replace(value.parse()?).is_some() {\n                    anyhow::bail!(\"the rebase state repeats marker-required\");\n                }\n            }\n            \"checkout-allowed\" => {\n                if checkout_allowed.replace(value.parse()?).is_some() {\n                    anyhow::bail!(\"the rebase state repeats checkout-allowed\");\n                }\n            }\n            \"head-ref\" => {\n                let encoded = value.as_bytes().as_bstr();\n                let (name, consumed) = gix::quote::ansi_c::undo(encoded)\n                    .map_err(gix::Exn::into_error)","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L672-L708","documentation":"Like `base`, the `onto` key in the rebase state anchor is single-valued. A second `onto <oid>` line makes the rebase's target commit ambiguous, so `parse_state` refuses the state instead of silently choosing one.","triggerScenarios":"Calling `parse` on a todo whose state anchor body lists `onto <oid>` more than once — duplicated state lines from hand edits, bad merges, or buggy generators.","commonSituations":"Manual anchor editing introducing a stray onto line; a merge/patch that duplicated the onto line inside the same anchor; scripted todo generation writing onto twice.","solutions":["Delete the extra `onto` line, keeping the correct target oid.","Regenerate the state anchor via tix rather than editing it manually.","Abort the rebase and restart to obtain a clean state block.","Sanity-check the anchor: `grep -c '^onto '` must return 1."],"exampleFix":"// before (inside anchor body)\n// onto aaa111...\n// onto bbb222...\nlet state = parse_state(repo, text)?; // bails\n\n// after\n// onto aaa111...   (single, correct onto)\nlet state = parse_state(repo, &dedupe_state_lines(text))?;","handlingStrategy":"validation","validationCode":"let onto_lines = body.lines().filter(|l| l.starts_with(\"onto \")).count();\nif onto_lines > 1 {\n    anyhow::bail!(\"state anchor declares onto more than once\");\n}","typeGuard":null,"tryCatchPattern":"match parse(repo, todo_text) {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"more than one onto target\") => {\n        // fix the anchor to a single onto line, then retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Avoid hand-editing state anchors; regenerate via tix","Check duplicated lines after applying patches to todo files","Lint anchor bodies: each of base/onto must appear exactly once"],"tags":["parsing","rebase","malformed-input","duplication"],"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-15T23:17:13.987Z"}