tonhowtf/omniget · error

arquivo nao encontrado

Error message

arquivo nao encontrado: {}

What it means

transcribe() validates that opts.input exists on disk before converting audio. If the path does not exist, this error with the original path embedded is returned. It is a plain Path::exists() check — no type/format validation happens here.

Solutions

  1. Check std::path::Path::new(&opts.input).exists() before calling transcribe.
  2. Convert `~` and relative paths to absolute paths (expand tilde manually; std does not).
  3. From a web UI, ensure the file is materialized on disk and its absolute path is sent.
  4. Re-check the path after user actions that may move the file.

Example fix

// before
whisper::transcribe(TranscribeOptions { input: "~/audio.mp3".into(), ..opts }, progress).await?;

// after
let input = shellexpand::tilde("~/audio.mp3").to_string();
let path = std::path::PathBuf::from(input).canonicalize()?;
anyhow::ensure!(path.exists(), "arquivo nao encontrado: {}", path.display());
whisper::transcribe(TranscribeOptions { input: path.to_string_lossy().into(), ..opts }, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

let path = std::path::PathBuf::from(&opts.input);
if !path.is_file() {
    eprintln!("arquivo nao encontrado: {}", opts.input);
    return;
}

Try / catch

match whisper::transcribe(opts, progress).await {
    Err(e) if e.to_string().contains("arquivo nao encontrado") => {
        // ask the user to re-pick the file; check path expansion
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling transcribe(TranscribeOptions{ input: <path>, .. }) with a path that does not exist: wrong relative path (resolved against the process CWD), file moved/deleted, wrong case on case-sensitive filesystems, or a path containing an unexpanded `~` or env var.

Common situations: Frontend sends a web-style path or blob URL instead of a real filesystem path; user renamed/moved the media file after picking it; passing `~/audio.mp3` literally since no shell expands it; running the app from a different working directory than expected.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

    Ok((language, cues))
}

pub async fn transcribe(
    opts: TranscribeOptions,
    progress: ProgressFn,
) -> anyhow::Result<TranscribeResult> {
    let (bin, _) = locate()
        .await
        .ok_or_else(|| anyhow!("whisper-cli nao esta instalado"))?;
    let model_path = models_dir()
        .ok_or_else(|| anyhow!("Could not determine data directory"))?
        .join(format!("ggml-{}.bin", opts.model));
    if !model_path.exists() {
        return Err(anyhow!("modelo {} nao esta baixado", opts.model));
    }
    let input = PathBuf::from(&opts.input);
    if !input.exists() {
        return Err(anyhow!("arquivo nao encontrado: {}", opts.input));
    }
    let id = format!("transcribe:{}", opts.input);
    report(&progress, &id, "convert", 0, Some(100), None);
    let started = std::time::Instant::now();
    let wav = to_wav16k(&input).await?;
    let out_prefix = super::temp_dir().join(format!("whisper-{}", uuid::Uuid::new_v4()));

    let mut cmd = crate::core::process::command(&bin);
    cmd.arg("-m").arg(&model_path).arg("-f").arg(&wav);
    cmd.args(["-oj", "-pp", "-np", "-of"]).arg(&out_prefix);
    let lang = if opts.language.trim().is_empty() {
        "auto"
    } else {
        opts.language.trim()
    };
    cmd.args(["-l", lang]);
    if opts.translate {
        cmd.arg("-tr");

View on GitHub (pinned to 8600b91f42)