{"record":{"id":"c87916fd92af66c9","repo":"GitoxideLabs/gitoxide","slug":"only-value-and-unspecified-are-possible-here","errorCode":null,"errorMessage":"only value and unspecified are possible here","messagePattern":"only value and unspecified are possible here","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-merge/src/blob/platform/prepare_merge.rs","lineNumber":66,"sourceCode":"            .map_err(|err| Error::Attributes {\n                source: err,\n                kind: ResourceKind::CurrentOrOurs,\n                rela_path: current.rela_path.clone(),\n            })?;\n        entry.matching_attributes(&mut self.attrs);\n        let mut attrs = self.attrs.iter_selected();\n        let merge_attr = attrs.next().expect(\"pre-initialized with 'merge'\");\n        let marker_size_attr = attrs.next().expect(\"pre-initialized with 'conflict-marker-size'\");\n        let mut driver = match merge_attr.assignment.state {\n            attributes::StateRef::Set => DriverChoice::BuiltIn(BuiltinDriver::Text),\n            attributes::StateRef::Unset => DriverChoice::BuiltIn(BuiltinDriver::Binary),\n            attributes::StateRef::Value(_) | attributes::StateRef::Unspecified => {\n                let name = match merge_attr.assignment.state {\n                    attributes::StateRef::Value(name) => Some(name.as_bstr()),\n                    attributes::StateRef::Unspecified => {\n                        self.options.default_driver.as_ref().map(|name| name.as_bstr())\n                    }\n                    _ => unreachable!(\"only value and unspecified are possible here\"),\n                };\n                self.find_driver_by_name(name)\n            }\n        };\n        if let attributes::StateRef::Value(value) = marker_size_attr.assignment.state\n            && let Some(value) = u8::from_str(value.as_bstr().to_str_lossy().as_ref())\n                .ok()\n                .and_then(NonZeroU8::new)\n        {\n            match &mut options.text.conflict {\n                Conflict::Keep { marker_size, .. } => *marker_size = value,\n                Conflict::ResolveWithOurs | Conflict::ResolveWithTheirs | Conflict::ResolveWithUnion => {}\n            }\n        }\n        if let Some(recursive_driver_name) = match driver {\n            DriverChoice::Index(idx) => self.drivers.get(idx),\n            _ => None,\n        }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-merge/src/blob/platform/prepare_merge.rs#L48-L84","documentation":"This is a Rust `unreachable!()` panic in `gix-merge`'s merge-driver selection. The outer match on `attributes::StateRef` already filtered to only `Value` and `Unspecified` variants, so any other variant here indicates the enum grew new variants without updating this match — a broken internal invariant, not a user-triggerable condition.","triggerScenarios":"Only triggered if the `gix_attributes::StateRef` enum gains a third variant (e.g. via a dependency upgrade of `gix-attributes`) while this match is not updated; effectively impossible on a consistent build of the crate.","commonSituations":"Hit during a merge that consults `merge` attributes to pick a merge driver when the compiled `gix-attributes` version disagrees with the code expectations; otherwise never seen in practice.","solutions":["Rebuild with consistent, semver-compatible versions of `gix-attributes` and `gix-merge` (run `cargo update -p gix-attributes` carefully and `cargo check`).","Update `gix-merge` to a version matching the installed `gix-attributes` (both from the same release train).","If you maintain the code, replace `unreachable!` with an explicit arm mapping the new variant to a driver or an error.","Report the panic upstream with the attribute configuration that triggered the merge."],"exampleFix":"// before\n_ => unreachable!(\"only value and unspecified are possible here\"),\n// after\nother => return Err(message!(\"unsupported attribute state {other:?} for merge driver\"))","handlingStrategy":"try-catch","validationCode":"// Ensure matching gix-merge / gix-attributes versions at build time\n// cargo tree -i gix-attributes  // confirm a single, expected version","typeGuard":null,"tryCatchPattern":"// Panics are not catchable safely in Rust; pin dependency versions.\n// gix = { version = \"X\", exact = true } // avoid mixed gix-* versions\n// Wrap merges in a subprocess (gix CLI) if panic isolation is required.","preventionTips":["Keep all gix-* crates on the same release version","Run cargo update deliberately and inspect gix-attributes bumps","Prefer catch_unwind boundaries when embedding gix in a long-running app"],"tags":["rust","panic","internal-invariant","merge-driver"],"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"}