{"record":{"id":"f3b7779da355a8ad","repo":"GitoxideLabs/gitoxide","slug":"the-rebase-todo-cannot-select-a-checkout-without-a","errorCode":null,"errorMessage":"the rebase todo cannot select a checkout without a worktree","messagePattern":"the rebase todo cannot select a checkout without a worktree","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":904,"sourceCode":"                anyhow::bail!(\"a fork target must be picked before it is used\");\n            } else {\n                rebase::PlanParent::Existing(id)\n            });\n            sections += 1;\n            section_has_commit = false;\n            section_last_step = None;\n            continue;\n        }\n        if line.starts_with('(') && line.ends_with(')') {\n            let target = cursor.context(\"a reference line must follow a fork or command\")?;\n            for (marked, value) in parse_ref_line(line)? {\n                let name = resolve_ref_name(repo, &mut state.expected_refs, value.as_bstr())?;\n                if ref_targets.insert(name.clone(), target).is_some() {\n                    anyhow::bail!(\"a reference is placed more than once\");\n                }\n                if marked {\n                    if !state.checkout_allowed || repo.workdir().is_none() {\n                        anyhow::bail!(\"the rebase todo cannot select a checkout without a worktree\");\n                    }\n                    if explicit_checkout_reference.replace((name, target)).is_some() {\n                        anyhow::bail!(\"the rebase todo contains more than one @ reference\");\n                    }\n                }\n            }\n            section_has_commit = true;\n            continue;\n        }\n\n        let (command, tail) = if let Some(line) = line.strip_prefix('`') {\n            let (command, tail) = line\n                .split_once('`')\n                .context(\"a Markdown todo command has no closing backtick\")?;\n            (command, tail.trim())\n        } else {\n            (line, \"\")\n        };","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L886-L922","documentation":"A reference line can mark a ref with `@` to select it as the checkout target after the rebase. This is only possible when the rebase state records checkout as allowed and the repository has a worktree; a bare repository or a checkout-disallowed state cannot honor the selection, so the todo is rejected.","triggerScenarios":"`parse` bails when a `@`-marked reference in a `( ... )` line is parsed while `state.checkout_allowed` is false or `repo.workdir()` is None. Happens when editing todos in a bare clone or when the rebase state was started in a mode that disallows checkout.","commonSituations":"Running tix in a bare repository or CI checkout without a worktree; carrying a `@` marker over from a template used in a normal clone; state started with checkout disabled.","solutions":["Remove the `@` marker from the reference line","Run the rebase in a non-bare repository with a worktree attached","Restart the rebase in a mode that permits checkout before using `@` selection"],"exampleFix":"// before\n(main @)\n// after (bare repo / checkout disallowed)\n(main)","handlingStrategy":"validation","validationCode":"if edited.contains(\"@)\") || edited.contains(\" @\\n\") {\n    if !checkout_allowed || repo.workdir().is_none() {\n        return Err(\"cannot use @ checkout selection without a worktree\");\n    }\n}","typeGuard":"fn can_use_checkout_marker(repo: &gix::Repository, checkout_allowed: bool) -> bool {\n    checkout_allowed && repo.workdir().is_some()\n}","tryCatchPattern":"if let Err(e) = parse(repo, edited) {\n    if e.to_string().contains(\"without a worktree\") {\n        // strip @ markers or open a non-bare worktree\n    }\n}","preventionTips":["Check `repo.workdir().is_some()` before offering checkout selection in UIs","Strip `@` markers when serializing todos for bare repositories","Document that checkout selection requires a worktree"],"tags":["rebase","todo-parsing","worktree"],"backgroundTag":"unsupported-operation","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"}