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

Model {} not found

Error message

Model {} not found

What it means

load_model looks the name up in the in-memory available_models map, which is populated by scanning the models directory (list_models). An unknown name - never scanned, misspelled, or not a whisper model in that directory - fails immediately with this error.

Source

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

            };
            
            models.push(model_info);
        }
        
        // Update internal cache
        let mut available_models = self.available_models.write().await;
        available_models.clear();
        for model in &models {
            available_models.insert(model.name.clone(), model.clone());
        }
        
        Ok(models)
    }
    
    pub async fn load_model(&self, model_name: &str) -> Result<()> {
        let models = self.available_models.read().await;
        let model_info = models.get(model_name)
            .ok_or_else(|| anyhow!("Model {} not found", model_name))?;

        match model_info.status {
            ModelStatus::Available => {
                // FIX 5: Check if this model is already loaded
                if let Some(current_model) = self.current_model.read().await.as_ref() {
                    if current_model == model_name {
                        log::info!("Model {} is already loaded, skipping reload", model_name);
                        return Ok(());
                    }

                    // FIX 5: Unload current model before loading new one
                    log::info!("Unloading current model '{}' before loading '{}'", current_model, model_name);
                    self.unload_model().await;
                }

                log::info!("Loading model: {}", model_name);

                // PERFORMANCE OPTIMIZATION: Use comprehensive hardware profile for optimal GPU configuration

View on GitHub (pinned to 0281737d87)

Solutions

  1. Call list_models()/refresh first, then pass an exact name it returned
  2. Verify spelling and case ('base' vs 'base.en' are different models)
  3. If the UI shows a model that load_model rejects, refresh the model list to resynchronize state with disk
Defensive patterns

Strategy: validation

Validate before calling

let models = engine.list_models().await?; // populates available_models
let valid: Vec<&str> = models.iter().map(|m| m.name.as_str()).collect();
if !valid.contains(&model_name) {
    return Err(anyhow!("unknown model {:?}; scanned: {:?}", model_name, valid));
}

Type guard

async fn model_exists(engine: &WhisperEngine, name: &str) -> bool {
    engine.available_models.read().await.contains_key(name)
}

Try / catch

try { engine.load_model(name).await? }
catch (e) if e.to_string().contains("not found") {
    let models = engine.list_models().await?; // rescan disk
    engine.load_model(models.first().unwrap().name.as_str()).await? // or resync UI
}

Prevention

When it happens

Trigger: Calling load_model('base.en') when the map only contains 'base'; calling load_model before list_models populated available_models; UI state referencing a model that is no longer present after the models directory changed.

Common situations: Frontend model list out of sync with the scanned disk state; a captured model name from before the models dir was changed/cleaned; case-sensitive mismatch between the stored setting and the scanned name.

Related errors


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