{"record":{"id":"462fc1948921d054","repo":"gitbutlerapp/gitbutler","slug":"failed-to-find-reference-target-in-rebase-editor","errorCode":null,"errorMessage":"Failed to find reference {target} in rebase editor","messagePattern":"Failed to find reference (.+?) in rebase editor","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-rebase/src/graph_rebase/mutate.rs","lineNumber":249,"sourceCode":"        editor.select_reference(self.as_ref())\n    }\n}\n\n/// Operations for mutating the commit graph\nimpl<M: RefMetadata> Editor<'_, '_, M> {\n    /// Get a selector to a particular commit in the graph\n    pub fn select_commit(&self, target: gix::ObjectId) -> Result<Selector> {\n        match self.try_select_commit(target) {\n            Some(selector) => Ok(selector),\n            None => Err(anyhow!(\"Failed to find commit {target} in rebase editor\")),\n        }\n    }\n\n    /// Get a selector to a particular reference in the graph\n    pub fn select_reference(&self, target: &gix::refs::FullNameRef) -> Result<Selector> {\n        match self.try_select_reference(target) {\n            Some(selector) => Ok(selector),\n            None => Err(anyhow!(\n                \"Failed to find reference {target} in rebase editor\"\n            )),\n        }\n    }\n\n    /// Get a selector to a particular commit in the graph\n    pub fn try_select_commit(&self, target: gix::ObjectId) -> Option<Selector> {\n        for node_idx in self.graph.node_indices() {\n            if let Step::Pick(Pick { id, .. }) = self.graph[node_idx]\n                && id == target\n            {\n                return Some(self.new_selector(node_idx));\n            }\n        }\n\n        None\n    }\n","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-rebase/src/graph_rebase/mutate.rs#L231-L267","documentation":"Editor::select_reference looks up a git reference by its full name in the rebase editor's graph and returns a Selector. This error is thrown when the reference is not present in the graph being edited, i.e. try_select_reference returned None.","triggerScenarios":"Calling select_reference with a refs::FullNameRef (e.g. refs/heads/my-branch) that the editor's graph does not contain — the ref wasn't included when the graph was constructed, or the ref name is wrong/typo'd.","commonSituations":"Rebasing scripts referencing a branch that was deleted or renamed, refs on remote namespaces not loaded into the graph, or passing a partial ref name instead of a fully qualified one.","solutions":["Confirm the fully qualified ref name (refs/heads/...) and that the ref exists in the repo","Use try_select_reference and handle None explicitly","Rebuild the Editor's graph including the reference before selecting it"],"exampleFix":"// before\nlet selector = editor.select_reference(target_ref)?;\n// after\nlet Some(selector) = editor.try_select_reference(target_ref) else {\n    anyhow::bail!(\"ref {target_ref} not present in rebase graph\");\n};","handlingStrategy":"validation","validationCode":"fn ref_in_graph(editor: &Editor<...>, target: &gix::refs::FullNameRef) -> bool {\n    editor.try_select_reference(target).is_some()\n}","typeGuard":null,"tryCatchPattern":"let selector = editor.try_select_reference(target)\n    .ok_or_else(|| anyhow::anyhow!(\"reference {target} not loaded into rebase graph\"))?;","preventionTips":["Always use fully qualified ref names (refs/heads/...)","Verify refs exist with a rev-parse before building steps","Rebuild the editor graph after ref deletions/renames"],"tags":["git","rebase","not-found"],"backgroundTag":"resource-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"}