{"record":{"id":"300d32c9d8c135e7","repo":"tonhowtf/omniget","slug":"arquivo-nao-encontrado","errorCode":null,"errorMessage":"arquivo nao encontrado: {}","messagePattern":"arquivo nao encontrado: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/whisper.rs","lineNumber":328,"sourceCode":"    Ok((language, cues))\n}\n\npub async fn transcribe(\n    opts: TranscribeOptions,\n    progress: ProgressFn,\n) -> anyhow::Result<TranscribeResult> {\n    let (bin, _) = locate()\n        .await\n        .ok_or_else(|| anyhow!(\"whisper-cli nao esta instalado\"))?;\n    let model_path = models_dir()\n        .ok_or_else(|| anyhow!(\"Could not determine data directory\"))?\n        .join(format!(\"ggml-{}.bin\", opts.model));\n    if !model_path.exists() {\n        return Err(anyhow!(\"modelo {} nao esta baixado\", opts.model));\n    }\n    let input = PathBuf::from(&opts.input);\n    if !input.exists() {\n        return Err(anyhow!(\"arquivo nao encontrado: {}\", opts.input));\n    }\n    let id = format!(\"transcribe:{}\", opts.input);\n    report(&progress, &id, \"convert\", 0, Some(100), None);\n    let started = std::time::Instant::now();\n    let wav = to_wav16k(&input).await?;\n    let out_prefix = super::temp_dir().join(format!(\"whisper-{}\", uuid::Uuid::new_v4()));\n\n    let mut cmd = crate::core::process::command(&bin);\n    cmd.arg(\"-m\").arg(&model_path).arg(\"-f\").arg(&wav);\n    cmd.args([\"-oj\", \"-pp\", \"-np\", \"-of\"]).arg(&out_prefix);\n    let lang = if opts.language.trim().is_empty() {\n        \"auto\"\n    } else {\n        opts.language.trim()\n    };\n    cmd.args([\"-l\", lang]);\n    if opts.translate {\n        cmd.arg(\"-tr\");","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/whisper.rs#L310-L346","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check std::path::Path::new(&opts.input).exists() before calling transcribe.","Convert `~` and relative paths to absolute paths (expand tilde manually; std does not).","From a web UI, ensure the file is materialized on disk and its absolute path is sent.","Re-check the path after user actions that may move the file."],"exampleFix":"// before\nwhisper::transcribe(TranscribeOptions { input: \"~/audio.mp3\".into(), ..opts }, progress).await?;\n\n// after\nlet input = shellexpand::tilde(\"~/audio.mp3\").to_string();\nlet path = std::path::PathBuf::from(input).canonicalize()?;\nanyhow::ensure!(path.exists(), \"arquivo nao encontrado: {}\", path.display());\nwhisper::transcribe(TranscribeOptions { input: path.to_string_lossy().into(), ..opts }, progress).await?;","handlingStrategy":"validation","validationCode":"let path = std::path::PathBuf::from(&opts.input);\nif !path.is_file() {\n    eprintln!(\"arquivo nao encontrado: {}\", opts.input);\n    return;\n}","typeGuard":null,"tryCatchPattern":"match whisper::transcribe(opts, progress).await {\n    Err(e) if e.to_string().contains(\"arquivo nao encontrado\") => {\n        // ask the user to re-pick the file; check path expansion\n    }\n    other => other?,\n}","preventionTips":["Send absolute, expanded filesystem paths (no `~`, no URLs).","Canonicalize paths before calling transcribe.","Re-validate existence after any user action that could move the file."],"tags":["file-not-found","path","validation"],"backgroundTag":"file-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}