{"record":{"id":"1c5c174634e5a670","repo":"Zackriya-Solutions/meetily","slug":"whisper-engine-not-initialized-1c5c17","errorCode":null,"errorMessage":"Whisper engine not initialized","messagePattern":"Whisper engine not initialized","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/retranscription.rs","lineNumber":575,"sourceCode":"                    warn!(\"Error during model discovery (continuing anyway): {}\", discover_err);\n                }\n\n                match e.load_model(&target_model).await {\n                    Ok(_) => {\n                        info!(\"Whisper model '{}' loaded successfully\", target_model);\n                        Ok(e)\n                    }\n                    Err(load_err) => {\n                        error!(\"Failed to load Whisper model '{}': {}\", target_model, load_err);\n                        Err(anyhow!(\"Failed to load Whisper model '{}': {}\", target_model, load_err))\n                    }\n                }\n            } else {\n                info!(\"Whisper model '{}' already loaded\", target_model);\n                Ok(e)\n            }\n        }\n        None => Err(anyhow!(\"Whisper engine not initialized\")),\n    }\n}\n\n/// Get the configured Whisper model name from the database\nasync fn get_configured_whisper_model<R: Runtime>(app: &AppHandle<R>) -> Result<String> {\n    debug!(\"Getting configured Whisper model from database...\");\n\n    let app_state = app\n        .try_state::<AppState>()\n        .ok_or_else(|| {\n            error!(\"App state not available\");\n            anyhow!(\"App state not available\")\n        })?;\n\n    debug!(\"Querying transcript_settings table...\");\n\n    // Query the transcript settings from the database - get both provider and model\n    let result: Option<(String, String)> = sqlx::query_as(","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/retranscription.rs#L557-L593","documentation":"The global WHISPER_ENGINE static (Mutex<Option<Arc<WhisperEngine>>>) is None. It is populated only by the whisper_init Tauri command (whisper_engine/commands.rs:41-52); get_or_init_whisper never constructs the engine itself, it only reuses or re-models an existing one. So retranscription fails if whisper_init never ran or failed.","triggerScenarios":"Frontend invokes start_retranscription before ever calling whisper_init; the app was just restarted and the user immediately retried a retranscription; whisper_init failed earlier (models directory error) leaving the slot empty; user has only ever used the Parakeet provider.","commonSituations":"A UI flow bug that skips engine init; provider switched to Parakeet or cloud, so Whisper engine construction never happens; init failure silently swallowed at startup.","solutions":["Call the whisper_init Tauri command from the frontend before start_retranscription.","Or make get_or_init_whisper construct the engine when None, mirroring whisper_init's WhisperEngine::new_with_models_dir call.","Check logs for 'Failed to initialize whisper engine' to see whether init ran and failed.","Ensure set_models_directory ran so the engine has a valid models dir."],"exampleFix":"// before (retranscription.rs:575)\nNone => Err(anyhow!(\"Whisper engine not initialized\")),\n\n// after: lazily construct the engine like whisper_init does\nNone => {\n    let models_dir = crate::whisper_engine::commands::models_directory();\n    let engine = WhisperEngine::new_with_models_dir(models_dir)\n        .map_err(|e| anyhow!(\"Failed to initialize whisper engine: {}\", e))?;\n    let engine = Arc::new(engine);\n    *WHISPER_ENGINE.lock().unwrap_or_else(|e| e.into_inner()) = Some(engine.clone());\n    Ok(engine)\n}","handlingStrategy":"validation","validationCode":"// Ensure engine init before the batch job\nuse crate::whisper_engine::commands::WHISPER_ENGINE;\nlet engine_ready = WHISPER_ENGINE.lock().unwrap_or_else(|e| e.into_inner()).is_some();\nif !engine_ready {\n    invoke_whisper_init(app).await?; // or call whisper_init command from the frontend first\n}","typeGuard":null,"tryCatchPattern":"// Give a precise, actionable message when the engine slot is empty\nNone => Err(anyhow!(\n    \"Whisper engine not initialized - call whisper_init before retranscription\"\n))","preventionTips":["Call the whisper_init command during app startup or before the retranscribe dialog opens.","Watch startup logs for 'Failed to initialize whisper engine' and fix init before retrying.","Consider making get_or_init_whisper lazily construct the engine so this class of error disappears."],"tags":["whisper","initialization","global-state","tauri"],"backgroundTag":"engine-not-initialized","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}