tonhowtf/omniget · error · anyhow::Error

{}

Error message

{}

What it means

convert_one shells out to ffmpeg (a quality-ladder conversion for WhatsApp stickers) and, when the process exits non-zero on the FIRST ladder step, returns the trimmed ffmpeg stderr verbatim via anyhow!("{}", msg). It propagates the raw ffmpeg diagnostic because at step one there is no prior good output to fall back to.

Solutions

  1. Run the same ffmpeg command manually to see the full stderr and fix the underlying cause
  2. Ensure ffmpeg is installed and the build supports the needed codecs (ffmpeg -codecs)
  3. Verify the input file is valid media (ffprobe it)
  4. Check disk space and permissions on the output directory
Defensive patterns

Strategy: try-catch

Validate before calling

let ok = std::process::Command::new("ffmpeg").arg("-version").output().map(|o| o.status.success()).unwrap_or(false);
if !ok { return Err("ffmpeg unavailable; cannot convert sticker"); }
let probe = std::process::Command::new("ffprobe").arg(&input).output()?;
if !probe.status.success() { return Err("input media is not decodable"); }

Try / catch

match convert_one(&input, &output, &spec).await {
    Err(e) => { tracing::error!("sticker convert failed: {e}"); /* surface ffmpeg stderr to user */ }
    Ok(item) => { /* use item */ }
}

Prevention

When it happens

Trigger: Calling convert_one (via the sticker tool's run) when the first ffmpeg quality attempt fails: ffmpeg binary missing/incompatible, unsupported or corrupt input file, or bad codec args — anything that makes ffmpeg print to stderr and exit non-zero while `best` is still None.

Common situations: ffmpeg not installed or not on PATH; input media corrupted or a format ffmpeg can't decode (e.g. HEVC without libhevc support in the build); a broken/custom ffmpeg build rejecting the flag set; disk-full or unreadable input path.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/sticker.rs:494

            progress,
            ID,
            "progress",
            tries as u64,
            None,
            Some(format!("{} · q{}", stem, attempt.quality)),
        );
        let out = crate::core::process::command(ffmpeg)
            .args(&args)
            .output()
            .await
            .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
        if !out.status.success() {
            let msg = String::from_utf8_lossy(&out.stderr).trim().to_string();
            // Falhar já no primeiro degrau é erro de verdade (codec ausente,
            // arquivo corrompido); nos degraus seguintes já existe um arquivo
            // bom na mão, então vale ficar com ele.
            if best.is_none() {
                return Err(anyhow!("{}", msg));
            }
            tracing::warn!(
                "[wa-sticker] tentativa q{} falhou: {}",
                attempt.quality,
                msg
            );
            break;
        }
        let bytes = std::fs::metadata(&output).map(|m| m.len()).unwrap_or(0);
        best = Some((bytes, attempt));
        if bytes <= spec.max_bytes {
            break;
        }
    }

    let (bytes, attempt) = best.ok_or_else(|| anyhow!("nenhuma tentativa rodou"))?;
    Ok(StickerItem {
        input: input.to_string(),

View on GitHub (pinned to 8600b91f42)