{"record":{"id":"4e607bd061f2fb95","repo":"Zackriya-Solutions/meetily","slug":"whisper-engine-not-initialized","errorCode":null,"errorMessage":"Whisper engine not initialized","messagePattern":"Whisper engine not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":792,"sourceCode":"\n            if needs_load {\n                info!(\n                    \"Loading Whisper model '{}' (current: {:?})\",\n                    target_model, current_model\n                );\n\n                if let Err(e) = e.discover_models().await {\n                    warn!(\"Model discovery error (continuing): {}\", e);\n                }\n\n                e.load_model(&target_model)\n                    .await\n                    .map_err(|e| anyhow!(\"Failed to load model '{}': {}\", target_model, e))?;\n            }\n\n            Ok(e)\n        }\n        None => Err(anyhow!(\"Whisper engine not initialized\")),\n    }\n}\n\n/// Get or initialize the Parakeet engine\nasync fn get_or_init_parakeet<R: Runtime>(\n    app: &AppHandle<R>,\n    requested_model: Option<&str>,\n) -> Result<Arc<ParakeetEngine>> {\n    use crate::parakeet_engine::commands::PARAKEET_ENGINE;\n\n    let engine = {\n        let guard = PARAKEET_ENGINE.lock().unwrap_or_else(|e| e.into_inner());\n        guard.as_ref().cloned()\n    };\n\n    match engine {\n        Some(e) => {\n            let target_model = match requested_model {","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L774-L810","documentation":"get_or_init_whisper only reads the process-global WHISPER_ENGINE static (a Mutex<Option<Arc<WhisperEngine>>>); it never constructs an engine. When the static is None — no whisper engine was created in this app session because the initialization command never ran or failed earlier — imports on the whisper path fail here. Despite the 'get_or_init' name, there is no lazy initialization.","triggerScenarios":"Starting an import (provider != 'parakeet', >0 VAD segments) in a fresh app session before any whisper engine initialization has happened; a prior engine-creation failure left the global unset; the init code path removed or reordered by a refactor.","commonSituations":"Cold start followed directly by import without visiting settings or loading a model first; automated tests invoking the import command without engine setup; nightly build where the init command was renamed.","solutions":["Trigger whisper engine initialization before import — run the same init/load path the model settings page uses, or invoke its Tauri command once at app start","Check logs since launch: an earlier engine-creation failure explains the None global","Make get_or_init_whisper actually lazy: construct and store the engine when None instead of erroring","In tests, populate WHISPER_ENGINE before calling the import command"],"exampleFix":"// before — None is a dead end\nmatch engine {\n    Some(e) => Ok(e),\n    None => Err(anyhow!(\"Whisper engine not initialized\")),\n}\n\n// after — initialize on miss\nlet engine = match engine {\n    Some(e) => e,\n    None => {\n        let e = Arc::new(WhisperEngine::new());\n        *WHISPER_ENGINE.lock().unwrap_or_else(|x| x.into_inner()) = Some(e.clone());\n        e\n    }\n};","handlingStrategy":"validation","validationCode":"// ensure the engine exists before starting an import\nuse crate::whisper_engine::commands::WHISPER_ENGINE;\nlet ready = WHISPER_ENGINE\n    .lock()\n    .map(|g| g.is_some())\n    .unwrap_or(false);\nif !ready { initialize_whisper_engine(&app).await?; }","typeGuard":"fn whisper_engine_ready() -> bool {\n    use crate::whisper_engine::commands::WHISPER_ENGINE;\n    WHISPER_ENGINE.lock().map(|g| g.is_some()).unwrap_or(false)\n}","tryCatchPattern":"Treat this error as unretryable at the call site: catch it, initialize the engine via the app's init path, then restart the import from the beginning — importing again is safe because cancellation cleaned the previous meeting folder.","preventionTips":["Initialize the whisper engine at app start or before the first import","Do not assume 'get_or_init' lazily initializes — it only reads the global","In tests, populate WHISPER_ENGINE before invoking import commands"],"tags":["whisper","initialization","global-state","tauri","rust"],"backgroundTag":"engine-not-initialized","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}