{"record":{"id":"88f71a752a57cd09","repo":"tonhowtf/omniget","slug":"nenhum-conserto-escolhido","errorCode":null,"errorMessage":"nenhum conserto escolhido","messagePattern":"nenhum conserto escolhido","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_restore.rs","lineNumber":136,"sourceCode":"\n/// `optzoom=1` deixa o filtro escolher o zoom mínimo que evita borda preta.\npub fn transform_filter(smoothing: u32) -> String {\n    format!(\n        \"vidstabtransform=smoothing={}:optzoom=1:interpol=bicubic,unsharp=5:5:0.8:3:3:0.4\",\n        smoothing.clamp(1, 100)\n    )\n}\n\nasync fn restore_one(\n    ffmpeg: &Path,\n    opts: &RestoreOptions,\n    input: &str,\n) -> anyhow::Result<RestoreItem> {\n    let inp = Path::new(input);\n    let bytes_before = std::fs::metadata(inp).map(|m| m.len()).unwrap_or(0);\n    let chain = restore_chain(opts);\n    if chain.is_none() && !opts.stabilize {\n        return Err(anyhow!(\"nenhum conserto escolhido\"));\n    }\n\n    let out_dir = if opts.output_dir.trim().is_empty() {\n        inp.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(&out_dir)?;\n    let stem = inp\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        opts.suffix.clone()\n    } else if opts.stabilize {\n        \"-estavel\".into()\n    } else {\n        \"-restaurado\".into()","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_restore.rs#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set at least one fix flag in RestoreOptions (e.g. denoise: true or deinterlace: true) before calling restore.","If the goal is only stabilization, set opts.stabilize = true.","On the caller side, validate the options object and reject no-op requests before invoking restore."],"exampleFix":"// before\nlet opts = RestoreOptions { output_dir: out.into(), ..Default::default() };\nrestore::run(opts, [input]).await?;\n// after\nlet opts = RestoreOptions { output_dir: out.into(), denoise: true, ..Default::default() };\nanyhow::ensure!(opts.stabilize || opts.any_fix_enabled(), \"escolha ao menos um conserto\");\nrestore::run(opts, [input]).await?;","handlingStrategy":"validation","validationCode":"// caller-side check before invoking restore\nfn has_fix(o: &RestoreOptions) -> bool {\n    o.stabilize || o.denoise || o.deinterlace || o.deshake || o.sharpen // add every fix flag here\n}\nanyhow::ensure!(has_fix(&opts), \"nenhum conserto escolhido: ative ao menos uma opção de restauração\");","typeGuard":"fn restore_requested(o: &RestoreOptions) -> bool { o.stabilize || o.any_fix_enabled() }","tryCatchPattern":"match restore_one(...).await {\n    Err(e) if e.to_string().contains(\"nenhum conserto escolhido\") => {\n        eprintln!(\"ative ao menos um conserto ou stabilize\");\n    }\n    r => r,\n}","preventionTips":["Validate RestoreOptions in the frontend before submitting the job.","Never send a default/empty options struct to restore.","Document which flags count as fixes and require at least one in the API schema."],"tags":["validation","missing-option","video-restore","rust"],"backgroundTag":"missing-required-option","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"}