{"record":{"id":"9f436664ff9f067b","repo":"janhq/jan","slug":"gguf-version-has-no-readable-tensor-block","errorCode":null,"errorMessage":"GGUF version {} has no readable tensor block","messagePattern":"GGUF version (.+?) has no readable tensor block","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/plugins/tauri-plugin-llamacpp/src/gguf/helpers.rs","lineNumber":45,"sourceCode":"/// every import to answer a yes/no question.\n///\n/// Only the first split of a sharded model is read, so a tensor living in a\n/// later shard is reported absent -- the same limit upstream's\n/// `common_speculative_types_from_gguf` documents.\npub fn find_gguf_tensors<R: Read + Seek>(\n    reader: R,\n    wanted: &[String],\n) -> io::Result<Vec<String>> {\n    let mut file = BufReader::new(reader);\n    let meta = read_header(&mut file)?;\n\n    if wanted.is_empty() {\n        return Ok(Vec::new());\n    }\n    // v1 sized strings and dimensions with u32s. llama.cpp refuses that\n    // version outright, and reading it as v2 would invent names.\n    if meta.version < 2 {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\"GGUF version {} has no readable tensor block\", meta.version),\n        ));\n    }\n    if meta.tensor_count > MAX_TENSORS {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\"tensor count {} is unreasonably large\", meta.tensor_count),\n        ));\n    }\n\n    let mut found: Vec<String> = Vec::new();\n    for i in 0..meta.tensor_count {\n        let name = read_gguf_string(&mut file).map_err(|e| {\n            io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"Failed to read name for tensor {}: {}\", i, e),\n            )","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/src-tauri/plugins/tauri-plugin-llamacpp/src/gguf/helpers.rs#L27-L63","documentation":"Raised by find_gguf_tensors when the GGUF file's version field is below 2. GGUF v1 encoded strings and dimensions with u32 lengths; llama.cpp refuses that version outright, and naively reading it as v2 would misparse names and invent garbage tensor entries. The function therefore rejects the file before attempting to walk the tensor block.","triggerScenarios":"find_gguf_tensors is called with a parsed GGUF metadata whose meta.version == 1 (or otherwise < 2), typically a very old GGML-era GGUF file produced before the v2 format change.","commonSituations":"Users point the plugin at ancient model files downloaded years ago (early llama.cpp GGUF dumps) that predate the v2/v3 format; converted legacy models retain version 1 headers.","solutions":["Re-download or obtain a GGUF v2+ version of the model from the source repository.","Re-convert the original weights with a current llama.cpp convert script so the header is written as v2+.","Check the file header's version field before loading so unsupported files are rejected early in the UI.","Do not attempt to force-parse v1 as v2; the string/dimension sizes differ and produce corrupt names."],"exampleFix":"// before: loading whatever GGUF is on disk\nlet tensors = find_gguf_tensors(&file, \"token_embd\")?;\n// after: check version first\nlet meta = read_gguf_metadata(&file)?;\nif meta.version < 2 { return Err(ServerError::InvalidArgument(\"GGUF v1 not supported; re-download as v2+\".into())); }\nlet tensors = find_gguf_tensors(&file, \"token_embd\")?;","handlingStrategy":"validation","validationCode":"fn ensure_gguf_v2_plus(path: &std::path::Path) -> Result<(), ServerError> {\n    let meta = read_gguf_metadata(path).map_err(ServerError::Io)?;\n    if meta.version < 2 {\n        return Err(ServerError::InvalidArgument(format!(\"GGUF v{} unsupported; re-download as v2+\", meta.version)));\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match find_gguf_tensors(&file, name) {\n    Err(e) if e.to_string().contains(\"has no readable tensor block\") => {\n        prompt_user(\"This model uses legacy GGUF v1. Please download a v2+ build.\");\n    }\n    other => other,\n}","preventionTips":["Check the GGUF header version before loading any model file.","Re-download legacy v1 models from sources that provide v2+ assets.","Re-convert old weights with a current llama.cpp converter.","Fail fast at model-selection time in the UI instead of at tensor-read time."],"tags":["gguf","file-format","versioning","rust","llamacpp"],"backgroundTag":"unsupported-config-value","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}