{"record":{"id":"45c521fb3a4755b6","repo":"tonhowtf/omniget","slug":"arquivo-n-o-existe","errorCode":null,"errorMessage":"arquivo não existe","messagePattern":"arquivo não existe","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/sticker.rs","lineNumber":423,"sourceCode":"    }\n}\n\nasync fn source_seconds(input: &Path) -> f64 {\n    crate::core::ffmpeg::probe(input)\n        .await\n        .map(|p| p.duration_seconds)\n        .unwrap_or(0.0)\n}\n\nasync fn convert_one(\n    ffmpeg: &Path,\n    opts: &StickerOptions,\n    input: &str,\n    progress: &super::ProgressFn,\n) -> anyhow::Result<StickerItem> {\n    let inp = Path::new(input);\n    if !inp.exists() {\n        return Err(anyhow!(\"arquivo não existe\"));\n    }\n    let animated = wants_animated(opts, input);\n    let mut spec = spec(&opts.target, animated);\n    if opts.max_kb > 0 {\n        spec.max_bytes = opts.max_kb * 1024;\n    }\n\n    let mut duration = opts.duration;\n    if animated {\n        let real = source_seconds(inp).await;\n        let sobra = (real - opts.start).max(0.0);\n        if sobra > 0.0 {\n            duration = if duration > 0.0 {\n                duration.min(sobra)\n            } else {\n                sobra\n            };\n        }","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/sticker.rs#L405-L441","documentation":"`convert_one` in sticker.rs validates that the sticker source file exists before doing any conversion work. If `Path::new(input).exists()` is false — the file is missing, deleted, renamed, or the path is wrong — it throws \"arquivo não existe\". This is the first guard in the sticker conversion pipeline (`run` -> `convert_one`).","triggerScenarios":"Calling the sticker conversion (`run`/`convert_one`) with `input` pointing to a nonexistent file: wrong relative path (wrong CWD), file deleted or renamed after listing, path with a typo, or a URL/remote path passed where only a local filesystem path is accepted.","commonSituations":"Users dragging in files from temp folders that were cleaned up; batch jobs whose input list was generated before files were moved; running the app from a different working directory so relative paths break; confusing sticker IDs with file paths.","solutions":["Check `std::path::Path::new(input).exists()` (or `std::fs::metadata(input).is_ok()`) before invoking conversion and surface a user-facing message with the resolved absolute path.","Resolve relative input paths to absolute paths (std::fs::canonicalize) against the intended base directory before calling the API.","Verify the file still exists right before conversion in batch workflows; re-enumerate the file list instead of using a stale one.","Ensure a local filesystem path is passed, not a URL or resource identifier — download/copy remote sources to disk first."],"exampleFix":"// before\nconvert_one(&opts, user_input, progress).await?;\n\n// after\nlet p = std::path::Path::new(&user_input);\nif !p.exists() {\n    return Err(anyhow!(\"arquivo de origem nao encontrado: {}\", p.display()));\n}\nconvert_one(&opts, &user_input, progress).await?;","handlingStrategy":"validation","validationCode":"let p = std::path::Path::new(input);\nif !p.is_file() {\n    return Err(anyhow!(\"entrada invalida/nao encontrada: {}\", p.display()));\n}","typeGuard":"fn is_existing_file(p: &str) -> bool {\n    std::fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)\n}","tryCatchPattern":"match convert_one(&opts, input, progress).await {\n    Err(e) if e.to_string().contains(\"arquivo n\\u00e3o existe\") => {\n        eprintln!(\"verifique o caminho: {}\", input);\n    }\n    r => { r?; }\n}","preventionTips":["Resolve user input to absolute paths with canonicalize before conversion","Re-verify file existence immediately before batch conversion runs","Never accept URLs/IDs where a filesystem path is expected; download first","Show the resolved absolute path in error messages to expose CWD confusion"],"tags":["filesystem","file-not-found","validation","media-conversion"],"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"}