{"record":{"id":"113ba6a18c492af8","repo":"aaif-goose/goose","slug":"resolved-gguf-model-has-no-local-files","errorCode":null,"errorMessage":"Resolved GGUF model has no local files","messagePattern":"Resolved GGUF model has no local files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-local-inference/src/hf_models.rs","lineNumber":2380,"sourceCode":"pub fn register_resolved_model(resolved: ResolvedLocalModel, source: &str) -> Result<String> {\n    let model_id = resolved.model_id();\n    let repo_id = resolved.repo_id().to_string();\n    let variant_id = resolved.variant_id().to_string();\n    let backend_id = resolved.backend_id().to_string();\n    let storage = resolved.storage();\n\n    let entry = match resolved {\n        ResolvedLocalModel::Gguf {\n            resolved,\n            local_paths,\n            mmproj_path,\n            ..\n        } => {\n            let first_file = &resolved.files[0];\n            let first_local_path = local_paths\n                .first()\n                .cloned()\n                .ok_or_else(|| anyhow::anyhow!(\"Resolved GGUF model has no local files\"))?;\n            let shard_files: Vec<ShardFile> = resolved\n                .files\n                .iter()\n                .skip(1)\n                .zip(local_paths.iter().skip(1))\n                .map(|(file, local_path)| ShardFile {\n                    filename: file.filename.clone(),\n                    local_path: local_path.clone(),\n                    source_url: file.download_url.clone(),\n                    size_bytes: file.size_bytes,\n                })\n                .collect();\n            let settings = super::local_model_registry::default_settings_for_model(&model_id);\n            super::local_model_registry::LocalModelEntry {\n                id: model_id.clone(),\n                repo_id,\n                filename: first_file.filename.clone(),\n                quantization: variant_id,","sourceCodeStart":2362,"sourceCodeEnd":2398,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-local-inference/src/hf_models.rs#L2362-L2398","documentation":"register_resolved_model destructures ResolvedLocalModel::Gguf and requires local_paths.first() to exist. local_paths is built one-per-file in download_gguf_to_hf_cache, and resolve_model_spec_full already bails when no GGUF matches, so an empty local_paths means an invariant was violated: a Gguf value was constructed with zero local files (programmatic misuse or an upstream bug), not a network failure.","triggerScenarios":"Hand-constructing ResolvedLocalModel::Gguf with empty resolved.files or empty local_paths; a code path that registers a resolved model without going through the download step.","commonSituations":"Internal callers or tests building the enum directly; refactors that skip download_gguf_to_hf_cache; partial construction during error handling.","solutions":["Only register models produced by resolve_local_model_selection / resolve_gguf_model","If hit in production unexpectedly, capture the repo_id/quantization and report it as a bug - the invariant upstream of this point failed","Add a construction-time check (see validation) so misuse fails at the boundary with a clearer message"],"exampleFix":"// before\nregister_resolved_model(ResolvedLocalModel::Gguf { resolved, local_paths: vec![], .. }, source)?;\n\n// after: fail at the boundary with a precise message\nanyhow::ensure!(!local_paths.is_empty(), \"GGUF model {repo_id} downloaded zero files\");\nregister_resolved_model(ResolvedLocalModel::Gguf { resolved, local_paths, .. }, source)?;","handlingStrategy":"validation","validationCode":"if matches!(&resolved, ResolvedLocalModel::Gguf { local_paths, .. } if local_paths.is_empty()) {\n    anyhow::bail!(\"refusing to register GGUF model with zero downloaded files\");\n}","typeGuard":"fn gguf_has_local_files(resolved: &ResolvedLocalModel) -> bool {\n    !matches!(resolved, ResolvedLocalModel::Gguf { local_paths, .. } if local_paths.is_empty())\n}","tryCatchPattern":"match register_resolved_model(resolved, source) {\n    Err(e) if e.to_string() == \"Resolved GGUF model has no local files\" => {\n        // invariant failure upstream: log repo/variant and report a bug; do not retry\n    }\n    other => other,\n}","preventionTips":["Never hand-construct ResolvedLocalModel::Gguf; obtain it from resolve_local_model_selection","Assert non-empty files/local_paths at the construction boundary in tests","Treat this error as a bug report trigger, not an environmental condition"],"tags":["rust","invariant","gguf","local-inference","registry"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}