{"record":{"id":"d1877970d4eefa0f","repo":"tonhowtf/omniget","slug":"ffmpeg-nao-iniciou-image-resize","errorCode":null,"errorMessage":"ffmpeg nao iniciou: {}","messagePattern":"ffmpeg nao iniciou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_resize.rs","lineNumber":112,"sourceCode":"            .arg(inp)\n            .args([\"-vf\", &filter]);\n        if ext == \"jpg\" || ext == \"jpeg\" {\n            cmd.args([\"-q:v\", &qv.to_string()]);\n        } else if ext == \"webp\" {\n            cmd.args([\"-quality\", &opts.quality.to_string()]);\n        }\n        cmd.arg(&out);\n        match cmd.output().await {\n            Ok(o) if o.status.success() => outputs.push(out.to_string_lossy().to_string()),\n            Ok(o) => {\n                tracing::warn!(\n                    \"[resize] {}: {}\",\n                    input,\n                    String::from_utf8_lossy(&o.stderr).trim()\n                );\n                failed.push(input.clone());\n            }\n            Err(e) => return Err(anyhow!(\"ffmpeg nao iniciou: {}\", e)),\n        }\n    }\n    super::report(&progress, \"resize\", \"done\", total, Some(total), None);\n    Ok(ResizeResult { outputs, failed })\n}\n\n#[cfg(test)]\nmod tests {\n    use super::scale_filter;\n\n    #[test]\n    fn filters() {\n        assert_eq!(scale_filter(\"width\", 800, 0), \"scale=800:-2\");\n        assert_eq!(scale_filter(\"percent\", 50, 0), \"scale=iw*50/100:ih*50/100\");\n        assert!(scale_filter(\"fit\", 1920, 1080).contains(\"force_original_aspect_ratio\"));\n    }\n}\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_resize.rs#L94-L130","documentation":"This error is thrown when the ffmpeg binary fails to spawn at all during the batch image-resize run, e.g. the process could not be started (missing binary, bad path) or the wait failed. It wraps the underlying std::process error with anyhow and aborts the whole run (unlike per-file failures, which are only recorded in `failed`).","triggerScenarios":"Calling run() on ImageResizeOptions when ffmpeg is not installed or not on PATH, the configured ffmpeg path is wrong, or std::process::Command::status()/output returns an Err (e.g. permission or OS spawn failure).","commonSituations":"Fresh CI containers or Docker images without ffmpeg; users who only installed ffmpeg client after app packaging; PATH differences between dev shell and GUI-launched Tauri app.","solutions":["Install ffmpeg and make sure it is on PATH (or point the tool's ffmpeg path config at the binary).","Verify with `ffmpeg -version` in the same environment the app runs in (GUI apps may inherit a different PATH).","If spawning a specific binary path, check it exists and is executable before running.","Keep the anyhow context (`ffmpeg nao iniciou: {}`) when propagating so the OS error message is preserved."],"exampleFix":"// before\nErr(e) => return Err(anyhow!(\"ffmpeg nao iniciou: {}\", e)),\n// after\n// ensure ffmpeg is locatable before the loop:\nif which::which(\"ffmpeg\").is_err() {\n    return Err(anyhow!(\"ffmpeg nao iniciou: binário não encontrado no PATH\"));\n}","handlingStrategy":"try-catch","validationCode":"// Rust: check ffmpeg availability before running\nfn ensure_ffmpeg() -> anyhow::Result<()> {\n    let st = std::process::Command::new(\"ffmpeg\").arg(\"-version\").output()?;\n    anyhow::ensure!(st.status.success(), \"ffmpeg não está disponível\");\n    Ok(ensure_ffmpeg()?)\n}","typeGuard":"fn ffmpeg_available() -> bool {\n    std::process::Command::new(\"ffmpeg\").arg(\"-version\").output().map(|o| o.status.success()).unwrap_or(false)\n}","tryCatchPattern":"match image_resize::run(&opts, &progress) {\n    Ok(r) => handle(r),\n    Err(e) if e.to_string().contains(\"ffmpeg nao iniciou\") => eprintln!(\"Instale o ffmpeg: {e:#}\"),\n    Err(e) => eprintln!(\"falhou: {e:#}\"),\n}","preventionTips":["Install ffmpeg in every environment the app ships to (CI, Docker, end-user machines).","Probe ffmpeg availability at app startup and disable resize features until present.","Bundle ffmpeg alongside the app or pin its absolute path in config.","Remember GUI-launched processes may have a different PATH than your shell."],"tags":["ffmpeg","process-spawn","external-dependency","rust"],"backgroundTag":"command-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}