{"record":{"id":"155462657e84e4d1","repo":"aaif-goose/goose","slug":"unknown-local-inference-backend","errorCode":null,"errorMessage":"Unknown local inference backend '{}'","messagePattern":"Unknown local inference backend '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-local-inference/src/management.rs","lineNumber":691,"sourceCode":"        }\n    }\n}\n\nfn explicit_model_selection(\n    req: &LocalInferenceModelDownloadRequest,\n) -> Result<Option<LocalModelSelection>> {\n    if let Some(backend_id) = req.backend_id.as_deref() {\n        let (repo_id, parsed_variant_id) = hf_models::parse_model_spec(&req.spec)\n            .map(|(repo_id, quantization)| (repo_id, Some(quantization)))\n            .unwrap_or_else(|_| (req.spec.clone(), None));\n        let variant_id = req.variant_id.clone().or(parsed_variant_id);\n        match backend_id {\n            \"mlx\" | \"llamacpp\" => Ok(Some(LocalModelSelection {\n                repo_id,\n                backend_id: backend_id.to_string(),\n                variant_id,\n            })),\n            _ => anyhow::bail!(\"Unknown local inference backend '{}'\", backend_id),\n        }\n    } else {\n        Ok(None)\n    }\n}\n\nasync fn local_model_id_from_request(\n    req: &LocalInferenceModelDownloadRequest,\n    selection: Option<&LocalModelSelection>,\n) -> Result<String> {\n    if let Some(selection) = selection {\n        return match selection.backend_id.as_str() {\n            \"mlx\" => Ok(selection.repo_id.clone()),\n            \"llamacpp\" => {\n                let quantization = selection.variant_id.as_deref().ok_or_else(|| {\n                    anyhow!(\n                        \"llama.cpp model '{}' is missing a quantization\",\n                        selection.repo_id","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-local-inference/src/management.rs#L673-L709","documentation":"resolve_local_model_selection() validates an explicit backend_id from a download request. Only \"mlx\" and \"llamacpp\" are recognized; anything else bails with 'Unknown local inference backend'. The comparison is exact and case-sensitive. If backend_id is omitted entirely, the function returns Ok(None) and selection falls through to spec-based auto-detection.","triggerScenarios":"A download request with backend_id set to an unsupported value: \"ollama\", \"vulkan\", \"cuda\", \"llama.cpp\" (dot instead of 'llamacpp'), \"MLX\" (wrong case), or with trailing whitespace. The bail fires before any network call or model resolution.","commonSituations":"UI dropdown or config template carrying a stale backend name after a rename; scripts copied from other tools' vocabulary (ollama/lmstudio); typo or case mismatch; backend names changing between goose versions.","solutions":["Use exactly \"mlx\" or \"llamacpp\" (lowercase) as backend_id.","Omit backend_id to let goose auto-detect from the model spec (returns Ok(None) here).","Remember MLX is macOS-only; on Linux/Windows choose \"llamacpp\".","Trim/normalize user input before constructing the request."],"exampleFix":"// before\nlet req = DownloadRequest { spec: \"Qwen/Qwen2.5-7B:Q4_K_M\".into(), backend_id: Some(\"llama.cpp\".into()), ..Default::default() };\n// -> Unknown local inference backend 'llama.cpp'\n\n// after\nlet req = DownloadRequest { spec: \"Qwen/Qwen2.5-7B:Q4_K_M\".into(), backend_id: Some(\"llamacpp\".into()), ..Default::default() };","handlingStrategy":"validation","validationCode":"const SUPPORTED_BACKENDS: &[&str] = &[\"mlx\", \"llamacpp\"];\nif let Some(backend) = req.backend_id.as_deref() {\n    anyhow::ensure!(\n        SUPPORTED_BACKENDS.contains(&backend),\n        \"backend_id must be one of {SUPPORTED_BACKENDS:?}, got '{backend}'\"\n    );\n}\nlet selection = resolve_selection(&req).await?;","typeGuard":"fn is_supported_local_backend(id: &str) -> bool {\n    matches!(id, \"mlx\" | \"llamacpp\")\n}","tryCatchPattern":"match download_model(req).await {\n    Ok(m) => Ok(m),\n    Err(e) if e.to_string().starts_with(\"Unknown local inference backend\") => {\n        req.backend_id = None; // retry with auto-detection\n        download_model(req).await\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Restrict backend pickers to the exact values 'mlx' and 'llamacpp' (lowercase).","Remember MLX is macOS-only; default to 'llamacpp' elsewhere.","Omit backend_id when unsure — spec-based auto-detection handles most cases."],"tags":["rust","validation","backend","download","local-inference","llamacpp","mlx"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}