{"record":{"id":"b852f2e60d391a0a","repo":"spacedriveapp/spacedrive","slug":"whisper-model-not-found-please-download-it-fi","errorCode":null,"errorMessage":"Whisper model not found: {}. Please download it first.","messagePattern":"Whisper model not found: (.+?)\\. Please download it first\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/src/ops/media/speech/mod.rs","lineNumber":45,"sourceCode":"#[cfg(feature = \"speech-to-text\")]\npub async fn transcribe_audio_file(\n\tsource_path: &Path,\n\tmodel: &str,\n\tlanguage: Option<&str>,\n\tdata_dir: &Path,\n) -> Result<String> {\n\tuse tokio::task::spawn_blocking;\n\n\tlet source = source_path.to_path_buf();\n\tlet model_name = model.to_string();\n\tlet lang = language.map(|s| s.to_string());\n\n\t// Get model path from data directory\n\tlet model_path = crate::ops::models::get_whisper_models_dir(data_dir)\n\t\t.join(format!(\"ggml-{}.bin\", model_name));\n\n\tif !model_path.exists() {\n\t\tanyhow::bail!(\n\t\t\t\"Whisper model not found: {}. Please download it first.\",\n\t\t\tmodel_path.display()\n\t\t);\n\t}\n\n\t// Run whisper in blocking task (CPU/GPU intensive)\n\tspawn_blocking(move || {\n\t\tuse whisper_rs::{FullParams, SamplingStrategy, WhisperContext, WhisperContextParameters};\n\n\t\t// Load model\n\t\tlet ctx = WhisperContext::new_with_params(\n\t\t\tmodel_path.to_str().context(\"Invalid model path\")?,\n\t\t\tWhisperContextParameters::default(),\n\t\t)\n\t\t.context(\"Failed to load Whisper model\")?;\n\n\t\t// Load and convert audio to 16kHz mono f32 samples\n\t\tlet audio_data = load_audio_samples(&source)?;","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/media/speech/mod.rs#L27-L63","documentation":"Raised by transcribe_audio_file when the Whisper GGML model file (ggml-<model>.bin) is missing from the models directory resolved by get_whisper_models_dir(data_dir). Whisper needs the model binary loaded from disk before any inference can run, so transcription aborts before spawn_blocking. The path is built from the WhisperModel selector, so any variant whose weights were never fetched fails immediately.","triggerScenarios":"Running the speech_to_text processor or calling transcribe_audio_file with a WhisperModel (e.g. Medium) whose ggml-medium.bin was never downloaded; enabling transcription on a fresh install; switching model size in settings without downloading the new weights; deleting the models directory under the data dir.","commonSituations":"Fresh installs where transcription started before the ModelDownloadJob finished; data dir moved or wiped; daemon running under a different user/home than the one that downloaded models; interrupted downloads leaving a truncated file that later gets cleaned up.","solutions":["Before transcribing, ensure the model exists: call ensure_whisper_model(ctx, model, &data_dir) (core/src/ops/models/ensure.rs) or dispatch ModelDownloadJob::for_whisper_model and wait for completion.","Verify the exact expected file: get_whisper_models_dir(&data_dir).join(format!(\"ggml-{}.bin\", model_name)) exists and is non-trivial in size.","Confirm the daemon's data dir matches the one the models were downloaded into (default_data_dir vs configured path), especially with daemon/CLI user mismatch.","Re-download via the models download action if the file is truncated (compare against model.size_bytes())."],"exampleFix":"// before\nlet srt = transcribe_audio_file(&entry.path, &self.model, None, &data_dir).await?;\n\n// after\nensure_whisper_model(ctx, self.model.clone(), &data_dir).await?;\nlet srt = transcribe_audio_file(&entry.path, &self.model, None, &data_dir).await?;","handlingStrategy":"validation","validationCode":"use crate::ops::models::{get_whisper_models_dir, whisper::WhisperModel};\n\nfn whisper_model_ready(data_dir: &std::path::Path, model: &WhisperModel) -> bool {\n\tget_whisper_models_dir(data_dir)\n\t\t.join(format!(\"ggml-{}.bin\", model))\n\t\t.exists()\n}","typeGuard":"fn is_missing_whisper_model(err: &anyhow::Error) -> bool {\n\terr.to_string().starts_with(\"Whisper model not found\")\n}","tryCatchPattern":"match transcribe_audio_file(&path, &model, lang, &data_dir).await {\n\tErr(e) if is_missing_whisper_model(&e) => // prompt user / dispatch model download, do not retry now\n\tErr(e) => return Err(e),\n\tOk(srt) => /* proceed */\n}","preventionTips":["Gate transcription jobs on ensure_whisper_model / a completed ModelDownloadJob before dispatch.","Surface model download state in UI/job logs so users see download progress before transcription is enabled.","Health-check the models dir at daemon startup and re-enqueue missing downloads."],"tags":["rust","whisper","speech-to-text","model-download","filesystem"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}