{"record":{"id":"8a93c76d628cd2b6","repo":"GitoxideLabs/gitoxide","slug":"an-reference-requires-an-command-at-the-same-r","errorCode":null,"errorMessage":"an @ reference requires an @ command at the same result","messagePattern":"an @ reference requires an @ command at the same result","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":1030,"sourceCode":"        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 {\n                reference.new = None;\n                reference.placement = ref_targets.remove(&reference.name);\n            }\n        }\n    }\n    let checkout = checkout_target.map(|target| rebase::PlanCheckout {\n        target,\n        reference: checkout_reference,\n    });","sourceCodeStart":1012,"sourceCodeEnd":1048,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L1012-L1048","documentation":"An `@`-marked entry inside a `(…)` reference line selects where HEAD's checkout is anchored, but it is only valid when a corresponding `@` command also exists in the todo, marking the same step. `parse` throws this error when a reference line contains an `@` entry while no `@` command (and no checkout target derived from one) was parsed.","triggerScenarios":"Writing `(@refs/heads/main)` in a reference line while no command line in the todo carries the `@` marker (the marked command was deleted or its `@` stripped).","commonSituations":"The user deletes the `@`-marked command line to drop a commit but leaves the `@` on the branch reference; todo templates that carry `@` on refs by default.","solutions":["Add an `@`-marked command (`pick @<id>` or `squash @<id>`) at the step the reference should point to.","Remove the `@` prefix from the reference entry in the `(…)` line if no explicit checkout should be selected.","Regenerate the todo via the tool to restore consistent pairing of `@` commands and references."],"exampleFix":"// before\n──── fork aaa1 ────\npick bbb2 ...\n(@refs/heads/main)\n\n// after (either)\n──── fork aaa1 ────\npick @bbb2 ...\n(@refs/heads/main)\n\n// or remove the marker:\n(refs/heads/main)","handlingStrategy":"validation","validationCode":"// Rust: an (@ref) entry requires a corresponding @-marked command somewhere in the todo\nlet has_at_ref = text.lines().any(|l| l.contains(\"(@\"));\nlet has_at_cmd = text.lines().any(|l| {\n    let t = l.trim();\n    (t.starts_with('@') || t.starts_with(\"`@\")) && !t.starts_with(\"(@\")\n});\nif has_at_ref && !has_at_cmd {\n    return Err(\"an @ reference requires an @ command\");\n}","typeGuard":null,"tryCatchPattern":"match parse_plan(&repo, text) {\n    Ok(plan) => apply(plan),\n    Err(e) if e.to_string().contains(\"requires an @ command\") => {\n        eprintln!(\"Remove the @ from the reference or add an @-marked command.\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["When deleting an `@`-marked command, also unmark the matching `(@ref)` entry.","Remember `@` on a reference line only works alongside an `@` command.","Prefer letting the tool generate the todo instead of adding markers manually."],"tags":["rebase","checkout-marker","todo-parsing"],"backgroundTag":"mutually-exclusive-options","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"}