{"record":{"id":"15372a202bd23cb3","repo":"cjpais/Handy","slug":"failed-to-load-whisper-model","errorCode":null,"errorMessage":"Failed to load whisper model {}: {}","messagePattern":"Failed to load whisper model (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":595,"sourceCode":"                        // valid exact device, backend selection handles the\n                        // retired generic GPU state and host CPU guard.\n                        let backend = if device.is_some() {\n                            Backend::Auto\n                        } else {\n                            select_transcribe_backend(accelerator)\n                        };\n                        (backend, device)\n                    }\n                };\n                let requested_device = device\n                    .as_ref()\n                    .map(transcribe_device_label)\n                    .unwrap_or_else(|| \"automatic\".to_string());\n                let model_options = ModelOptions { backend, device };\n                let model = Model::load_with(&model_path, &model_options).map_err(|e| {\n                    let error_msg = format!(\"Failed to load whisper model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                // The bound backend may differ from the request (e.g. CPU\n                // fallback under Auto); log what actually loaded.\n                let bound_backend = model.backend();\n                let session = model.session().map_err(|e| {\n                    let error_msg = format!(\n                        \"Failed to create session for whisper model {}: {}\",\n                        model_id, e\n                    );\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                // Reconcile the registry's advertised capabilities with the\n                // loaded model's real ones (GGUF metadata) so badges/gating\n                // reflect runtime truth, not the pre-download probe. The\n                // load-completed event below triggers the frontend refresh.\n                let caps = session.model().capabilities();\n                self.model_manager.set_runtime_capabilities(","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/cjpais/Handy/blob/ba10ce1943ef34e93c09494027fc0b9ced2e8a44/src-tauri/src/managers/transcription.rs#L577-L613","documentation":"Raised when transcribe-cpp's Model::load_with(path, ModelOptions{backend, gpu_device}) fails to load a Whisper-family GGUF. The failure comes from the native GGML layer: unreadable/corrupt GGUF file, unsupported model architecture or quantization, or backend initialization failure (e.g. Vulkan driver problems) including under Auto when even the CPU fallback path fails. A 'loading_failed' event is emitted with the same message before returning.","triggerScenarios":"Loading a GGUF that is corrupt (failed disk copy), too new for the bundled transcribe-cpp version, quantized in an unsupported format, or requesting a GPU backend whose driver/runtime fails to initialize (missing Vulkan ICD, outdated drivers, out of VRAM).","commonSituations":"Models copied between machines with interrupted transfers; newly published GGUF quants needing a newer llama.cpp-compatible revision; headless/Linux systems without Vulkan drivers; Windows GPU driver updates breaking loader init; 32-bit quant files on backends lacking support.","solutions":["Check the tail of the error for the native cause; 'failed to open/read file' means the GGUF path is bad or truncated — re-download the model.","Switch the transcription accelerator setting to CPU and retry; if CPU loads fine, the problem is GPU backend init (update Vulkan/GPU drivers or use CPU).","Re-download the model from the catalog to rule out corruption (hash-verified on download).","Try a different quantization/size variant of the same model — the format may be unsupported by the bundled transcribe-cpp build.","On Linux, verify Vulkan is installed (vulkaninfo) if requesting Vulkan/Auto."],"exampleFix":"// before\nlet model = Model::load_with(&model_path, &ModelOptions { backend, gpu_device })?;\n\n// after — fall back to CPU when the requested backend cannot load the model\nlet model = match Model::load_with(&model_path, &opts) {\n    Ok(m) => m,\n    Err(e) if !matches!(backend, Backend::Cpu) => {\n        warn!(\"load with {backend:?} failed ({e}); retrying on CPU\");\n        Model::load_with(&model_path, &ModelOptions { backend: Backend::Cpu, gpu_device: None })?\n    }\n    Err(e) => return Err(anyhow::anyhow!(\"Failed to load whisper model {model_id}: {e}\")),\n};","handlingStrategy":"fallback","validationCode":"// Cheap pre-flight: file exists and is non-trivial before the native load\nlet meta = std::fs::metadata(&model_path)?;\nif meta.len() < 100_000_000 {\n    anyhow::bail!(\"GGUF at {} is {} bytes — suspiciously small, re-download\", model_path.display(), meta.len());\n}","typeGuard":null,"tryCatchPattern":"match Model::load_with(&model_path, &opts) {\n    Ok(m) => Ok(m),\n    Err(e) if !matches!(backend, Backend::Cpu) => {\n        warn!(\"{backend:?} load failed ({e}); falling back to CPU\");\n        Model::load_with(&model_path, &ModelOptions { backend: Backend::Cpu, gpu_device: None })\n    }\n    Err(e) => Err(anyhow::anyhow!(\"Failed to load whisper model {model_id}: {e}\")),\n}","preventionTips":["Default to Auto/CPU-capable paths and only promise GPU when the driver stack is known good.","Keep GPU drivers updated and verify Vulkan works (vulkaninfo) before selecting GPU backends.","Only load hash-verified downloads — re-download instead of retrying a suspect GGUF.","Check free memory against model size (plus compute buffers) before large loads."],"tags":["whisper","gguf","transcribe-cpp","model-load","gpu","vulkan"],"backgroundTag":"model-load-failed","analyzedSha":"ba10ce1943ef34e93c09494027fc0b9ced2e8a44","analyzedAt":"2026-08-17T10:29:55.597Z","contentChangedAt":"2026-08-17T10:29:55.597Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}