tonhowtf/omniget · error

modelo desconhecido

Error message

modelo desconhecido: {}

What it means

download_model validates the requested model id against the static MODELS table and throws 'modelo desconhecido: {}' (unknown model) if the id is not present. It guards against downloading arbitrary or misspelled model names from Hugging Face.

Solutions

  1. Call the list-models function (the fn collecting over MODELS above download_model) and pick a valid id from it.
  2. Check for typos or version suffixes in the id; ids must exactly match the MODELS table.
  3. Update persisted user settings/migrations that reference removed model ids.
  4. If a new model is genuinely needed, add it to the MODELS constant with its size and URL.

Example fix

// before
let model_id = "whisper-big";
download_model(model_id, progress).await?;
// after
let model_id = "base"; // must be one of the ids listed by the list-models API
assert!(whisper::list_models().iter().any(|m| m.id == model_id));
download_model(model_id, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

const VALID_MODELS: &[&str] = &["tiny", "base", "small", "medium", "large"];
fn is_known_model(id: &str) -> bool { VALID_MODELS.contains(&id) }
// call: if !is_known_model(user_id) { return Err(...) }

Type guard

fn is_known_model(id: &str) -> bool {
    whisper::list_models().iter().any(|m| m.id == id)
}

Try / catch

match download_model(id, progress).await {
    Err(e) if e.to_string().starts_with("modelo desconhecido") => {
        eprintln!("unknown model '{}'; available: {:?}", id,
            whisper::list_models().iter().map(|m| m.id).collect::<Vec<_>>());
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling download_model with an id string that is not one of the known MODELS entries: typo, stale UI list, or a model id invented by an LLM/tool caller.

Common situations: Typing 'whisper-large-v3-turbo' when only specific ggml ids are supported, old persisted settings referencing a model removed from MODELS, or a command-line argument passed straight through without validation.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/8db1fb1dc3c17e2b. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/whisper.rs:87

                label: id
                    .replace('-', " ")
                    .replace("q5_0", "(q5)")
                    .replace("q5_1", "(q5)"),
                size_mb: *mb,
                note: note.to_string(),
                installed: size > 0,
                path: path
                    .filter(|_| size > 0)
                    .map(|p| p.to_string_lossy().to_string()),
                size_bytes: size,
            }
        })
        .collect()
}

pub async fn download_model(id: &str, progress: ProgressFn) -> anyhow::Result<PathBuf> {
    if !MODELS.iter().any(|(m, _, _)| *m == id) {
        return Err(anyhow!("modelo desconhecido: {}", id));
    }
    let dir = models_dir().ok_or_else(|| anyhow!("Could not determine data directory"))?;
    std::fs::create_dir_all(&dir)?;
    let dest = dir.join(format!("ggml-{}.bin", id));
    let url = format!("{}/ggml-{}.bin", HF_BASE, id);
    let client = super::client()?;
    super::download_to(
        &client,
        &url,
        &dest,
        &progress,
        &format!("whisper-model:{}", id),
    )
    .await?;
    Ok(dest)
}

pub fn remove_model(id: &str) -> anyhow::Result<()> {

View on GitHub (pinned to 8600b91f42)