{"record":{"id":"f0eff93c3dd0f236","repo":"gitbutlerapp/gitbutler","slug":"visible-worktree-name-was-listed-more-than-once","errorCode":null,"errorMessage":"Visible worktree {name} was listed more than once","messagePattern":"Visible worktree (.+?) was listed more than once","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-rebase/src/graph_rebase/creation.rs","lineNumber":354,"sourceCode":"                    format!(\n                        \"Visible detached worktree {} HEAD {} is missing from the editor\",\n                        tip.name, tip.id\n                    )\n                })?,\n            };\n            let name = tip.name.clone();\n            let checkout = Checkout::Worktree {\n                worktree_name: name.clone(),\n                selector: Selector {\n                    id: selector,\n                    revision: 0,\n                },\n                ref_name: tip.ref_name,\n                initial_head: tip.id,\n                merge_base_override: None,\n            };\n            if worktree_checkouts.insert(name.clone(), checkout).is_some() {\n                bail!(\"Visible worktree {name} was listed more than once\");\n            }\n        }\n\n        let checkouts = worktree_checkouts\n            .into_values()\n            .chain(head_selectors.into_iter().map(|selector| Checkout::Head {\n                selector,\n                merge_base_override: None,\n            }))\n            .collect();\n\n        Ok(Self {\n            graph,\n            initial_references: references,\n            checkouts,\n            repo: repo.clone().with_object_memory(),\n            history: RevisionHistory::new(),\n            workspace,","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-rebase/src/graph_rebase/creation.rs#L336-L372","documentation":"When building a graph-rebase Editor from workspace tips, each visible (linked) worktree contributes one checkout keyed by its name. The builder inserts checkouts into a map keyed by name and bails if the same worktree name appears twice — one checkout per visible worktree is an invariant.","triggerScenarios":"Constructing the editor from a tip list where two entries carry the same worktree `name`: duplicated rows from the listing query, or a hand-assembled spec list concatenating two snapshots.","commonSituations":"Workspace listings computed twice and concatenated; stale plus fresh entries around a worktree rename; custom tooling aggregating tips from multiple sources.","solutions":["Deduplicate tip entries by worktree name before building the editor","Fix the upstream listing so it comes from a single query/snapshot","Refresh workspace state and rebuild the tip list if a rename is in flight"],"exampleFix":"// before\nlet tips = old_tips.iter().chain(refreshed_tips.iter()); // may duplicate worktrees\n\n// after\nlet mut seen = std::collections::HashSet::new();\nlet tips = tips.into_iter().filter(|t| seen.insert(t.name.clone()));","handlingStrategy":"validation","validationCode":"// Rust: deduplicate worktree tips by name before building the editor\nlet mut seen = std::collections::HashSet::new();\nlet unique_tips: Vec<_> = tips\n    .into_iter()\n    .filter(|t| seen.insert(t.name.clone()))\n    .collect();\nlet editor = Editor::from_tips(unique_tips)?;","typeGuard":null,"tryCatchPattern":"Catch the bail, report which worktree name was duplicated, and rebuild the tip list from a single fresh snapshot before retrying.","preventionTips":["Build worktree listings from one query/snapshot instead of concatenating sources","Guard against duplicates at the listing boundary, especially around worktree renames"],"tags":["worktree","editor","duplicates","graph-rebase","validation"],"backgroundTag":"duplicate-entry-validation","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}