janhq/jan · error · io::Error

Unknown GGUF value type

Error message

Unknown GGUF value type: {}

What it means

GgufValueType::try_from maps the u32 value-type tag of a GGUF metadata entry to the enum and fails with InvalidData for any tag outside 0-12. GGUF defines exactly 13 value types; an unknown tag means the file was written by a newer spec revision or the stream is misaligned.

Solutions

  1. Re-export or re-quantize the model with a current llama.cpp version whose GGUF output matches the tags this parser knows (0-12)
  2. Re-download the file and verify its checksum if the tag looks like garbage rather than a plausible new type
  3. Add the new value type to the GgufValueType enum (match arm + read_gguf_value arm) if you must support the newer spec
  4. Check whether an earlier parse error desynchronized the walk before this tag was read

Example fix

// before
// types.rs: only 0-12 handled; new spec type 13 fails
// after
impl TryFrom<u32> for GgufValueType {
    fn try_from(value: u32) -> Result<Self, Self::Error> {
        match value {
            // ...existing 0..=12 arms...
            13 => Ok(Self::Float128), // newly added spec type
            _ => Err(io::Error::new(io::ErrorKind::InvalidData,
                format!("Unknown GGUF value type: {value}"))),
        }
    }
}
Defensive patterns

Strategy: try-catch

Try / catch

match read_gguf_metadata(file) {
    Err(e) if e.to_string().starts_with("Unknown GGUF value type") => {
        eprintln!("model uses a newer GGUF value type: {e}; update or re-export");
    }
    other => other?,
}

Prevention

When it happens

Trigger: read_metadata_entry (directly, or for array element types inside read_gguf_value) encounters a value-type tag > 12 while parsing read_gguf_metadata / find_gguf_tensors input.

Common situations: Files written by a newer llama.cpp GGUF version that added value types, corrupted files where the type field is garbage, desynchronized parsing, hand-crafted or fuzzed inputs.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17). Data as JSON: /api/errors/fd8caf7efd788635. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/plugins/tauri-plugin-llamacpp/src/gguf/types.rs:41

impl TryFrom<u32> for GgufValueType {
    type Error = io::Error;
    fn try_from(value: u32) -> Result<Self, Self::Error> {
        match value {
            0 => Ok(Self::Uint8),
            1 => Ok(Self::Int8),
            2 => Ok(Self::Uint16),
            3 => Ok(Self::Int16),
            4 => Ok(Self::Uint32),
            5 => Ok(Self::Int32),
            6 => Ok(Self::Float32),
            7 => Ok(Self::Bool),
            8 => Ok(Self::String),
            9 => Ok(Self::Array),
            10 => Ok(Self::Uint64),
            11 => Ok(Self::Int64),
            12 => Ok(Self::Float64),
            _ => Err(io::Error::new(
                io::ErrorKind::InvalidData,
                format!("Unknown GGUF value type: {}", value),
            )),
        }
    }
}

#[derive(Serialize)]
pub struct GgufMetadata {
    pub version: u32,
    pub tensor_count: u64,
    pub metadata: HashMap<String, String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct KVCacheEstimate {
    pub size: u64,
    pub per_token_size: u64,

View on GitHub (pinned to 7205d770c1)