{"record":{"id":"7f9548234ef3b938","repo":"tonhowtf/omniget","slug":"legenda-n-o-encontrada","errorCode":null,"errorMessage":"legenda não encontrada","messagePattern":"legenda não encontrada","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/subtitle.rs","lineNumber":468,"sourceCode":"    pub suffix: String,\n}\n\nfn default_font_size() -> u32 {\n    24\n}\n\n/// O filtro `subtitles` recebe o caminho dentro de uma string do FFmpeg:\n/// dois-pontos separam opções e a barra invertida do Windows é escape.\npub fn escape_filter_path(path: &str) -> String {\n    path.replace('\\\\', \"/\").replace(':', \"\\\\:\")\n}\n\npub async fn burn(opts: BurnOptions, progress: super::ProgressFn) -> anyhow::Result<String> {\n    let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;\n    let video = Path::new(&opts.video);\n    let sub = Path::new(&opts.subtitle);\n    if !sub.exists() {\n        return Err(anyhow!(\"legenda não encontrada\"));\n    }\n    let dir = if opts.output_dir.trim().is_empty() {\n        video.parent().map(|p| p.to_path_buf()).unwrap_or_default()\n    } else {\n        PathBuf::from(opts.output_dir.trim())\n    };\n    std::fs::create_dir_all(&dir)?;\n    let stem = video\n        .file_stem()\n        .map(|s| s.to_string_lossy().to_string())\n        .unwrap_or_else(|| \"video\".into());\n    let suffix = if opts.suffix.is_empty() {\n        \"-legendado\"\n    } else {\n        opts.suffix.as_str()\n    };\n    let output = dir.join(format!(\"{}{}.mp4\", stem, suffix));\n","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/subtitle.rs#L450-L486","documentation":"subtitle::burn checks that opts.subtitle exists on disk before invoking ffmpeg; if not it throws \"legenda não encontrada\" (subtitle not found). It is an explicit pre-flight existence check so ffmpeg isn't started with a missing subtitles filter input.","triggerScenarios":"Calling burn with BurnOptions.subtitle pointing at a path that does not exist — deleted/moved file, relative path resolved from a different working directory, or a typo in the path.","commonSituations":"Passing a URL or an output filename that will be created later instead of an existing subtitle file; working-directory mismatch making relative paths break; subtitle file removed between selection and burn.","solutions":["Check the path with std::path::Path::exists() before calling burn","Convert relative paths to absolute before passing them in BurnOptions","Ensure the subtitle file was actually downloaded/written before burning"],"exampleFix":"// before\nburn(&BurnOptions { subtitle: \"subs.srt\".into(), .. })\n// after\nlet sub = std::fs::canonicalize(\"subs.srt\")?;\nburn(&BurnOptions { subtitle: sub.to_string_lossy().into(), .. })","handlingStrategy":"validation","validationCode":"let sub = std::path::Path::new(&opts.subtitle);\nif !sub.is_file() { return Err(format!(\"subtitle file missing: {}\", sub.display())); }","typeGuard":null,"tryCatchPattern":"match burn(opts, progress).await {\n    Err(e) if e.to_string().contains(\"legenda não encontrada\") => { /* re-pick subtitle file in UI */ }\n    other => other,\n}","preventionTips":["Resolve subtitle paths to absolute before calling burn","Download/write the subtitle fully before burning","Use file pickers that return existing paths","Re-check existence if the file may have been deleted between steps"],"tags":["subtitle","file-not-found","ffmpeg","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"}