{"record":{"id":"d2f9f42d6ced11ae","repo":"gitbutlerapp/gitbutler","slug":"handled-above-d2f9f4","errorCode":null,"errorMessage":"handled above","messagePattern":"handled above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-graph/src/init/mod.rs","lineNumber":2227,"sourceCode":"                    (None, CommitFlags::empty()),\n                    target_limit,\n                    commit_graph,\n                    repo,\n                    buf,\n                )?;\n            }\n            continue;\n        }\n\n        let (flags, limit) = match &tip.role {\n            TipRole::Reachable if tip.is_entrypoint => {\n                graph.entrypoint = Some((segment, EntryPointCommit::AtCommit(tip.id)));\n                (entrypoint_flags, max_limit)\n            }\n            TipRole::Reachable => {\n                reachable_tip_flags_and_limit(tip.id, entrypoint, max_limit, goals)\n            }\n            TipRole::TargetRemote => unreachable!(\"handled above\"),\n            TipRole::Workspace => {\n                if tip.is_entrypoint && graph.entrypoint.is_none() {\n                    graph.entrypoint = Some((segment, EntryPointCommit::AtCommit(tip.id)));\n                }\n                let extra_flags = if tip.is_entrypoint {\n                    entrypoint_flags\n                } else {\n                    CommitFlags::empty()\n                };\n                let limit = if tip.is_entrypoint {\n                    max_limit\n                } else {\n                    max_limit.with_indirect_goal(entrypoint, goals)\n                };\n                (\n                    CommitFlags::InWorkspace | CommitFlags::NotInRemote | extra_flags,\n                    limit,\n                )","sourceCodeStart":2209,"sourceCodeEnd":2245,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-graph/src/init/mod.rs#L2209-L2245","documentation":"During but-graph initialization, segment tips are matched on `TipRole`; `TipRole::TargetRemote` is marked `unreachable!(\"handled above\")` because remote-target tips are selected and processed in an earlier phase of the same loop, so by the time this match runs no TargetRemote tips remain. Like the sibling 'handled above' markers, it is an ordering invariant: the panic fires only if the earlier TargetRemote handling is removed or made incomplete while this match still assumes it.","triggerScenarios":"Refactoring the tip-processing loop so TargetRemote tips are no longer fully consumed earlier; adding new tip sources that inject TargetRemote roles after the early phase; merges that reorder the two passes.","commonSituations":"Graph-initialization refactors in but-graph; extending `TipRole` with new remote-tracking semantics; snapshot-test failures after reordering logic.","solutions":["Keep the early TargetRemote pass exhaustive over all tip sources before this match runs.","Replace `unreachable!` with a defensive `continue` (plus a `debug_assert!` or tracing warning) if the invariant is hard to guarantee during refactors.","Add a graph-init fixture with remote-target tips to the snapshot tests so reordering breaks tests, not production."],"exampleFix":"// before\nTipRole::TargetRemote => unreachable!(\"handled above\"),\n\n// after\nTipRole::TargetRemote => {\n    // ordering invariant: consumed in the earlier pass; keep safe during refactors\n    debug_assert!(false, \"TargetRemote should have been handled above\");\n    continue;\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn consumed_earlier(role: &TipRole) -> bool {\n    matches!(role, TipRole::TargetRemote)\n}","tryCatchPattern":null,"preventionTips":["Keep the early TargetRemote selection pass exhaustive before the tip-role match runs.","When reordering the loop, convert unreachable! arms to defensive continues with debug_assert!.","Maintain graph-init fixtures containing remote-target tips so ordering breaks in tests first."],"tags":["rust","but-graph","tip-roles","enum-matching","internal-invariant"],"backgroundTag":"unreachable-enum-variant","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}