{"record":{"id":"aebaf5ccc3a4e20a","repo":"gitbutlerapp/gitbutler","slug":"worktree-worktree-name-has-no-checkout-recorded-in-the","errorCode":null,"errorMessage":"Worktree {worktree_name} has no checkout recorded in the editor","messagePattern":"Worktree (.+?) has no checkout recorded in the editor","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-rebase/src/graph_rebase/commit.rs","lineNumber":61,"sourceCode":"    /// before mutating the step graph.\n    pub fn set_worktree_merge_base_override(\n        &mut self,\n        worktree_name: &gix::bstr::BStr,\n        tree_id: gix::ObjectId,\n    ) -> Result<()> {\n        for checkout in &mut self.checkouts {\n            if let super::Checkout::Worktree {\n                worktree_name: name,\n                merge_base_override,\n                ..\n            } = checkout\n                && name == worktree_name\n            {\n                *merge_base_override = Some(tree_id);\n                return Ok(());\n            }\n        }\n        bail!(\"Worktree {worktree_name} has no checkout recorded in the editor\")\n    }\n\n    /// Finds a commit from inside the editor's in memory repository.\n    pub fn find_commit(&self, id: gix::ObjectId) -> Result<but_core::CommitOwned> {\n        but_core::Commit::from_id(id.attach(&self.repo)).map(|c| c.detach())\n    }\n\n    /// Finds a commit that is selectable in the editor graph and is\n    /// found in the editor's repo.\n    ///\n    /// Returns the normalized selector and the found commit.\n    pub fn find_selectable_commit(\n        &self,\n        selector: impl ToCommitSelector,\n    ) -> Result<(Selector, but_core::CommitOwned)> {\n        let selector = self\n            .history\n            .normalize_selector(selector.to_commit_selector(self)?)?;","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-rebase/src/graph_rebase/commit.rs#L43-L79","documentation":"The graph rebase editor records a checkout (name, ref, head) for each visible worktree when created. When a caller later sets a merge-base override by worktree name, the editor searches its recorded worktrees and bails if no checkout with that exact name exists. This indicates a stale or misspelled worktree name relative to the editor's snapshot.","triggerScenarios":"Calling `set_worktree_merge_base_override` with a `worktree_name` that was never recorded (worktree created after the editor, removed before, or name mismatch e.g. different casing/branch vs worktree name).","commonSituations":"A worktree was added or pruned between editor creation and the override call; passing a branch name where a worktree name is expected; typos in worktree names constructed programmatically.","solutions":["List the editor's recorded worktree checkouts and use an exact recorded name","Recreate the editor (create_with_opts) so its worktree snapshot includes the worktree","Verify the worktree still exists (`git worktree list`) and its name matches exactly before calling"],"exampleFix":"// before\neditor.set_worktree_merge_base_override(\"feature-x\", tree_id)?;\n// after\nif editor.worktree_names().contains(&\"feature-x\".into()) {\n    editor.set_worktree_merge_base_override(\"feature-x\", tree_id)?;\n}","handlingStrategy":"validation","validationCode":"anyhow::ensure!(\n    editor.worktree_names().iter().any(|n| n == worktree_name),\n    \"worktree {} not recorded in this editor\", worktree_name\n);","typeGuard":null,"tryCatchPattern":"match editor.set_worktree_merge_base_override(name, tree_id) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"no checkout recorded\") => {\n        // recreate editor to pick up current worktrees, then retry\n        let editor = create_with_opts(&workspace, &tips, opts)?;\n        editor.set_worktree_merge_base_override(name, tree_id)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Look up worktree names from the editor's own recorded checkouts","Recreate the editor after worktrees are added/removed","Avoid renaming worktrees between editor creation and use"],"tags":["worktree","rebase","lookup-failure"],"backgroundTag":"record-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}