{"record":{"id":"a298d40db0d4cf4d","repo":"GitoxideLabs/gitoxide","slug":"the-current-checkout-marker-must-be-retained","errorCode":null,"errorMessage":"the current checkout marker must be retained","messagePattern":"the current checkout marker must be retained","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":1021,"sourceCode":"        cursor = Some(rebase::PlanParent::Step(index));\n        section_last_step = Some(index);\n        if marked {\n            let target = rebase::PlanParent::Step(index);\n            if checkout_target.is_some_and(|checkout| checkout != target) {\n                anyhow::bail!(\"the @ command and @ reference point to different results\");\n            }\n            checkout_target = Some(target);\n        }\n        section_has_commit = true;\n    }\n    if sections == 0 {\n        anyhow::bail!(\"the rebase todo has no fork heading\");\n    }\n    if sections > 1 && !section_has_commit {\n        anyhow::bail!(\"the last fork section contains no commits\");\n    }\n    if state.marker_required && checkout_target.is_none() {\n        anyhow::bail!(\"the current checkout marker must be retained\");\n    }\n    let checkout_reference = match (checkout_target, explicit_checkout_reference) {\n        (Some(target), Some((name, reference_target))) => {\n            if target != reference_target {\n                anyhow::bail!(\"the @ command and @ reference point to different results\");\n            }\n            Some(name)\n        }\n        (None, Some(_)) => anyhow::bail!(\"an @ reference requires an @ command at the same result\"),\n        (Some(target), None) => state\n            .head_ref\n            .take()\n            .filter(|name| ref_targets.get(name) == Some(&target)),\n        (None, None) => None,\n    };\n    if state.edit_refs {\n        for reference in &mut state.expected_refs {\n            if reference.editable {","sourceCodeStart":1003,"sourceCodeEnd":1039,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L1003-L1039","documentation":"When the ongoing rebase already had a checkout marker (HEAD detached at a todo step), the edited todo must retain exactly one `@`-marked command so the checkout position is preserved. If `state.marker_required` is set and no `@`-prefixed command (or `@`-marked reference) remains in the todo, `parse` fails with this error to prevent silently dropping the checkout marker.","triggerScenarios":"Editing a todo mid-rebase where HEAD is checked out at a step, and the user removes the `@` prefix from the marked `pick @...`/`squash @...` command or deletes that line entirely.","commonSituations":"A user cleans up `@` marks thinking they are noise; a global find-and-replace strips `@`; a hand-crafted todo omits the marker that a continuing rebase requires.","solutions":["Re-add the `@` prefix to the command representing the step where HEAD should stay checked out.","Mark a `(ref …)` line with `@` so the checkout is carried by the reference placement instead.","If the checkout is intentionally obsolete, restart the rebase/todo edit from the tool rather than hand-editing."],"exampleFix":"// before\n──── fork aaa1 ────\npick bbb2 ...\n\n// after (marker restored)\n──── fork aaa1 ────\npick @bbb2 ...","handlingStrategy":"validation","validationCode":"// Rust: if the tool flagged a required checkout marker, verify one `@` command exists\nlet has_marked = text.lines().any(|l| {\n    let t = l.trim();\n    t.starts_with(\"@\") || t.starts_with(\"`@\") || t.contains(\"(@\")\n});\nif marker_required && !has_marked {\n    return Err(\"keep one @-marked command to retain the checkout\");\n}","typeGuard":null,"tryCatchPattern":"match parse_plan(&repo, text) {\n    Ok(plan) => apply(plan),\n    Err(e) if e.to_string().contains(\"checkout marker must be retained\") => {\n        eprintln!(\"Re-add the @ marker to the step where HEAD is checked out.\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Treat `@` markers as load-bearing; never strip them in bulk find-and-replace.","When dropping the marked line, move the `@` to another command in the same plan.","Understand that during an interrupted rebase the checkout position must be re-stated in the todo."],"tags":["rebase","checkout-marker","todo-parsing"],"backgroundTag":"missing-required-argument","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"}