Zackriya-Solutions/meetily · critical · anyhow::Error

Failed to load model {}: {}

Error message

Failed to load model {}: {}

What it means

WhisperContext::new_with_params (whisper-rs) failed to load the model file with the computed context parameters. The GGML backend rejected the file or could not create a context: the file is corrupt, is not a whisper model, or memory/VRAM allocation for the (optionally GPU) context failed.

Source

Thrown at frontend/src-tauri/src/whisper_engine/whisper_engine.rs:314

                };

                log::info!(
                    "Whisper acceleration decision: compiled_backend={} runtime_detected_gpu={:?} use_gpu={} flash_attn={} gpu_device={}",
                    acceleration.compiled_backend.as_str(),
                    acceleration.runtime_detected_gpu,
                    acceleration.use_gpu,
                    acceleration.flash_attn,
                    acceleration.gpu_device,
                );

                // PERFORMANCE: Suppress verbose C library logs during model loading
                // This hides the excessive Metal/GGML initialization logs in release builds
                let ctx = {
                    // let _suppressor = crate::whisper_engine::StderrSuppressor::new();

                    // Load whisper context with hardware-optimized parameters
                    WhisperContext::new_with_params(&model_info.path.to_string_lossy(), context_param)
                        .map_err(|e| anyhow!("Failed to load model {}: {}", model_name, e))?
                    // Suppressor dropped here, stderr restored
                };

                // Update current context and model
                *self.current_context.write().await = Some(ctx);
                *self.current_model.write().await = Some(model_name.to_string());

                // Enhanced acceleration status reporting
                let acceleration_status = acceleration.status_label();

                log::info!("Successfully loaded model: {} with {} (Performance Tier: {:?}, Beam Size: {}, Threads: {:?})",
                          model_name, acceleration_status, hardware_profile.performance_tier,
                          adaptive_config.beam_size, adaptive_config.max_threads);
                Ok(())
            },
            ModelStatus::Missing => {
                Err(anyhow!("Model {} is not downloaded", model_name))
            },

View on GitHub (pinned to 0281737d87)

Solutions

  1. Delete and re-download the model via the model manager, then load again
  2. Confirm the file is a whisper-model GGML/GGUF, not an LLM model file that happens to share the extension
  3. If the logs show Metal/CUDA/Vulkan errors, update drivers or select the CPU acceleration path instead
  4. Free GPU/system memory (close other GPU apps, unload the summary LLM) and retry the load
Defensive patterns

Strategy: try-catch

Validate before calling

use std::io::Read;
fn looks_like_whisper_model(path: &Path) -> std::io::Result<bool> {
    let mut f = std::fs::File::open(path)?;
    let mut magic = [0u8; 4];
    f.read_exact(&mut magic)?;
    Ok(&magic == b"ggml" || &magic == b"GGUF" || &magic == b"ggjt" || &magic == b"ggla")
}
// before load_model:
if !looks_like_whisper_model(&model_path)? { return Err(anyhow!("not a whisper model file")); }

Try / catch

match engine.load_model(name).await {
    Err(e) => {
        log::error!("load failed for {}: {} - keeping previous model loaded", name, e);
        // previous current_context/current_model remain intact; offer re-download
        if e.to_string().contains("Failed to load model") {
            engine.delete_model(name).await.ok();
            engine.download_model(name).await?;
            engine.load_model(name).await?;
        } else { return Err(e); }
    }
    ok => ok,
}

Prevention

When it happens

Trigger: load_model on a model whose file is corrupted (truncated download), is a GGUF for a different architecture (an LLM GGUF placed into the whisper models directory), or when GPU context creation fails - Metal/CUDA/Vulkan initialization error or insufficient VRAM.

Common situations: Partial downloads passing the filename check but truncated inside; mixing llama.cpp GGUF models into whisper's models folder; outdated GPU drivers or busy VRAM causing context creation failure on first GPU load.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/df2ec2ef122a8cdf. Report an issue: GitHub.