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

Whisper engine not initialized

Error message

Whisper engine not initialized

What it means

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.

Source

Thrown at frontend/src-tauri/src/audio/retranscription.rs:575

                    warn!("Error during model discovery (continuing anyway): {}", discover_err);
                }

                match e.load_model(&target_model).await {
                    Ok(_) => {
                        info!("Whisper model '{}' loaded successfully", target_model);
                        Ok(e)
                    }
                    Err(load_err) => {
                        error!("Failed to load Whisper model '{}': {}", target_model, load_err);
                        Err(anyhow!("Failed to load Whisper model '{}': {}", target_model, load_err))
                    }
                }
            } else {
                info!("Whisper model '{}' already loaded", target_model);
                Ok(e)
            }
        }
        None => Err(anyhow!("Whisper engine not initialized")),
    }
}

/// Get the configured Whisper model name from the database
async fn get_configured_whisper_model<R: Runtime>(app: &AppHandle<R>) -> Result<String> {
    debug!("Getting configured Whisper model from database...");

    let app_state = app
        .try_state::<AppState>()
        .ok_or_else(|| {
            error!("App state not available");
            anyhow!("App state not available")
        })?;

    debug!("Querying transcript_settings table...");

    // Query the transcript settings from the database - get both provider and model
    let result: Option<(String, String)> = sqlx::query_as(

View on GitHub (pinned to 0281737d87)

Solutions

  1. Call the whisper_init Tauri command from the frontend before start_retranscription.
  2. Or make get_or_init_whisper construct the engine when None, mirroring whisper_init's WhisperEngine::new_with_models_dir call.
  3. Check logs for 'Failed to initialize whisper engine' to see whether init ran and failed.
  4. Ensure set_models_directory ran so the engine has a valid models dir.

Example fix

// before (retranscription.rs:575)
None => Err(anyhow!("Whisper engine not initialized")),

// after: lazily construct the engine like whisper_init does
None => {
    let models_dir = crate::whisper_engine::commands::models_directory();
    let engine = WhisperEngine::new_with_models_dir(models_dir)
        .map_err(|e| anyhow!("Failed to initialize whisper engine: {}", e))?;
    let engine = Arc::new(engine);
    *WHISPER_ENGINE.lock().unwrap_or_else(|e| e.into_inner()) = Some(engine.clone());
    Ok(engine)
}
Defensive patterns

Strategy: validation

Validate before calling

// Ensure engine init before the batch job
use crate::whisper_engine::commands::WHISPER_ENGINE;
let engine_ready = WHISPER_ENGINE.lock().unwrap_or_else(|e| e.into_inner()).is_some();
if !engine_ready {
    invoke_whisper_init(app).await?; // or call whisper_init command from the frontend first
}

Try / catch

// Give a precise, actionable message when the engine slot is empty
None => Err(anyhow!(
    "Whisper engine not initialized - call whisper_init before retranscription"
))

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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