tonhowtf/omniget · error

nenhum conserto escolhido

Error message

nenhum conserto escolhido

What it means

restore_one builds a fix chain via restore_chain(opts) and throws 'nenhum conserto escolhido' when no repair option was selected (chain is None) and stabilize is false. The library requires at least one restoration operation to run.

Solutions

  1. Set at least one fix flag in RestoreOptions (e.g. denoise: true or deinterlace: true) before calling restore.
  2. If the goal is only stabilization, set opts.stabilize = true.
  3. On the caller side, validate the options object and reject no-op requests before invoking restore.

Example fix

// before
let opts = RestoreOptions { output_dir: out.into(), ..Default::default() };
restore::run(opts, [input]).await?;
// after
let opts = RestoreOptions { output_dir: out.into(), denoise: true, ..Default::default() };
anyhow::ensure!(opts.stabilize || opts.any_fix_enabled(), "escolha ao menos um conserto");
restore::run(opts, [input]).await?;
Defensive patterns

Strategy: validation

Validate before calling

// caller-side check before invoking restore
fn has_fix(o: &RestoreOptions) -> bool {
    o.stabilize || o.denoise || o.deinterlace || o.deshake || o.sharpen // add every fix flag here
}
anyhow::ensure!(has_fix(&opts), "nenhum conserto escolhido: ative ao menos uma opção de restauração");

Type guard

fn restore_requested(o: &RestoreOptions) -> bool { o.stabilize || o.any_fix_enabled() }

Try / catch

match restore_one(...).await {
    Err(e) if e.to_string().contains("nenhum conserto escolhido") => {
        eprintln!("ative ao menos um conserto ou stabilize");
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling video restore with a RestoreOptions where every fix flag (denoise, deinterlace, deshake, contrast/sharpen, etc.) is unset/false and stabilize is false — e.g. a default-constructed options struct passed to run.

Common situations: Frontend sends an empty options object because UI checkboxes were never bound; API caller forgets to set any fix fields; defaults changed so previously 'on by default' flags now default to false.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/video_restore.rs:136

/// `optzoom=1` deixa o filtro escolher o zoom mínimo que evita borda preta.
pub fn transform_filter(smoothing: u32) -> String {
    format!(
        "vidstabtransform=smoothing={}:optzoom=1:interpol=bicubic,unsharp=5:5:0.8:3:3:0.4",
        smoothing.clamp(1, 100)
    )
}

async fn restore_one(
    ffmpeg: &Path,
    opts: &RestoreOptions,
    input: &str,
) -> anyhow::Result<RestoreItem> {
    let inp = Path::new(input);
    let bytes_before = std::fs::metadata(inp).map(|m| m.len()).unwrap_or(0);
    let chain = restore_chain(opts);
    if chain.is_none() && !opts.stabilize {
        return Err(anyhow!("nenhum conserto escolhido"));
    }

    let out_dir = if opts.output_dir.trim().is_empty() {
        inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()
    } else {
        PathBuf::from(opts.output_dir.trim())
    };
    std::fs::create_dir_all(&out_dir)?;
    let stem = inp
        .file_stem()
        .map(|s| s.to_string_lossy().to_string())
        .unwrap_or_else(|| "video".into());
    let suffix = if !opts.suffix.is_empty() {
        opts.suffix.clone()
    } else if opts.stabilize {
        "-estavel".into()
    } else {
        "-restaurado".into()

View on GitHub (pinned to 8600b91f42)