{"record":{"id":"842ee8f1c95f481c","repo":"GitoxideLabs/gitoxide","slug":"fixed-size-array-with-three-items","errorCode":null,"errorMessage":"fixed size array with three items","messagePattern":"fixed size array with three items","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-merge/src/tree/mod.rs","lineNumber":573,"sourceCode":"                        } => (\n                            Some(renamed_unique_path_to_modified_blob.as_bstr()),\n                            conflict.ours.location(),\n                        ),\n                        ResolutionFailure::OursAddedTheirsAddedTypeMismatch { their_unique_location } => {\n                            (Some(their_unique_location.as_bstr()), conflict.ours.location())\n                        }\n                    },\n                };\n                let source_path = conflict.ours.source_location();\n\n                let entries_with_stage = conflict.entries().into_iter().enumerate().filter_map(|(idx, entry)| {\n                    entry.filter(|e| e.mode.is_no_tree()).map(|e| {\n                        (\n                            match idx {\n                                0 => gix_index::entry::Stage::Base,\n                                1 => gix_index::entry::Stage::Ours,\n                                2 => gix_index::entry::Stage::Theirs,\n                                _ => unreachable!(\"fixed size array with three items\"),\n                            },\n                            match e.path_hint {\n                                None => renamed_path.unwrap_or(current_path),\n                                Some(ConflictIndexEntryPathHint::Source) => source_path,\n                                Some(ConflictIndexEntryPathHint::Current) => current_path,\n                                Some(ConflictIndexEntryPathHint::RenamedOrTheirs) => {\n                                    renamed_path.unwrap_or_else(|| conflict.changes_in_resolution().1.location())\n                                }\n                            },\n                            e,\n                        )\n                    })\n                });\n\n                if !entries_with_stage.clone().any(|(_, path, _)| {\n                    index\n                        .entry_index_by_path_and_stage_bounded(path, gix_index::entry::Stage::Unconflicted, len)\n                        .is_some()","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-merge/src/tree/mod.rs#L555-L591","documentation":"`apply_index_entries` in `gix-merge` maps conflict stage slots from a fixed 3-element array (Base/Ours/Theirs). The `unreachable!` fires if the index exceeds 2, which the fixed-size array makes impossible — a compiler-invariant defense.","triggerScenarios":"Never reachable with the current fixed-size array; only a hazard if the stages array type is changed to a slice/Vec later.","commonSituations":"Not hit in real merges; appears only during code evolution mistakes.","solutions":["No user action needed; if hit, report upstream with the conflict reproduction.","If maintaining, prefer exhaustive `Stage` iteration or `TryFrom` over `unreachable!` on index conversion."],"exampleFix":"// before\n_ => unreachable!(\"fixed size array with three items\"),\n// after\n_ => Stage::try_from(idx as u8).expect(\"stage array has exactly Base/Ours/Theirs\"),","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Compiler-guaranteed unreachable; no caller guard possible.","preventionTips":["No user-side action required","When contributing, use typed Stage iteration instead of index matches"],"tags":["rust","panic","internal-invariant","index-stages"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}