{"record":{"id":"fd8caf7efd788635","repo":"janhq/jan","slug":"unknown-gguf-value-type","errorCode":null,"errorMessage":"Unknown GGUF value type: {}","messagePattern":"Unknown GGUF value type: (.+?)","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/plugins/tauri-plugin-llamacpp/src/gguf/types.rs","lineNumber":41,"sourceCode":"\nimpl TryFrom<u32> for GgufValueType {\n    type Error = io::Error;\n    fn try_from(value: u32) -> Result<Self, Self::Error> {\n        match value {\n            0 => Ok(Self::Uint8),\n            1 => Ok(Self::Int8),\n            2 => Ok(Self::Uint16),\n            3 => Ok(Self::Int16),\n            4 => Ok(Self::Uint32),\n            5 => Ok(Self::Int32),\n            6 => Ok(Self::Float32),\n            7 => Ok(Self::Bool),\n            8 => Ok(Self::String),\n            9 => Ok(Self::Array),\n            10 => Ok(Self::Uint64),\n            11 => Ok(Self::Int64),\n            12 => Ok(Self::Float64),\n            _ => Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"Unknown GGUF value type: {}\", value),\n            )),\n        }\n    }\n}\n\n#[derive(Serialize)]\npub struct GgufMetadata {\n    pub version: u32,\n    pub tensor_count: u64,\n    pub metadata: HashMap<String, String>,\n}\n\n#[derive(Debug, Serialize, Deserialize)]\npub struct KVCacheEstimate {\n    pub size: u64,\n    pub per_token_size: u64,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/src-tauri/plugins/tauri-plugin-llamacpp/src/gguf/types.rs#L23-L59","documentation":"Returned by `TryFrom<u32>` for `GgufValueType` when the discriminator read from the stream is not in 0..=12. The GGUF spec assigns 0=Uint8, 1=Int8, 2=Uint16, 3=Int16, 4=Uint32, 5=Int32, 6=Float32, 7=Bool, 8=String, 9=Array, 10=Uint64, 11=Int64, 12=Float64. Any other value is rejected.","triggerScenarios":"Reading the value-type discriminator (u32 LE) of a metadata entry, or the element type of an Array, and getting a value outside 0..=12. Almost always indicates stream misalignment (reading a length or data byte as a type tag) or a corrupt file. The message echoes the offending discriminator value, which is a strong diagnostic clue.","commonSituations":"Misalignment after an earlier field was misread; a GGUF from a buggy/older writer that emits a non-spec type tag; corruption. If the value is large (e.g. millions), it is almost certainly a misread length, not a type tag.","solutions":["Look at the printed value: small numbers (13-255) suggest an unknown but plausible type extension; large numbers scream misalignment.","Re-check alignment of preceding fields per the GGUF spec (lengths are u64 LE, type tags are u32 LE).","Hex-dump around the failing offset to confirm the type-tag bytes.","If the file is from a newer GGUF revision that added a type, update this enum to support it; otherwise re-download."],"exampleFix":"// before\n_ => Err(io::Error::new(InvalidData, format!(\"Unknown GGUF value type: {}\", value))),\n\n// after - distinguish known-but-unsupported from clear garbage\n_ => {\n    let hint = if value > 1024 { \" (looks like misalignment)\" } else { \"\" };\n    Err(io::Error::new(InvalidData,\n        format!(\"Unknown GGUF value type: {}{}\", value, hint)))\n}","handlingStrategy":"try-catch","validationCode":"const KNOWN_TYPES: &[u32] = &[0,1,2,3,4,5,6,7,8,9,10,11,12];\nfn is_known_value_type(v: u32) -> bool { KNOWN_TYPES.contains(&v) }","typeGuard":"fn is_known_value_type(v: u32) -> bool { matches!(v, 0..=12) }","tryCatchPattern":"let vt = GgufValueType::try_from(raw_u32);\nmatch vt {\n    Ok(t) => Ok(t),\n    Err(e) => {\n        tracing::error!(\"unknown GGUF value type {raw_u32} — likely misalignment\");\n        Err(CorruptFile(e.to_string()))\n    }\n}","preventionTips":["Treat unknown type discriminators as misalignment/corruption signals until proven otherwise.","Hex-dump the region around the failure to confirm.","Update the enum when a new GGUF spec revision adds a type."],"tags":["gguf","value-type","enum","validation","llamacpp","rust"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}