{"record":{"id":"ca4a656329ddf294","repo":"tonhowtf/omniget","slug":"nenhuma-opera-o-escolhida","errorCode":null,"errorMessage":"nenhuma operação escolhida","messagePattern":"nenhuma operação escolhida","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/audio_clean.rs","lineNumber":200,"sourceCode":"        .any(|s| s.codec_type == \"video\" && s.codec_name != \"mjpeg\" && s.codec_name != \"png\");\n    let (target_i, target_tp) = target_for(&opts.target);\n\n    let mut chain: Vec<String> = Vec::new();\n    let mut measured = None;\n    if opts.mode == \"denoise\" || opts.mode == \"both\" {\n        chain.push(denoise_filter(\n            &opts.denoise_mode,\n            opts.strength,\n            (!opts.rnnn_path.trim().is_empty()).then_some(opts.rnnn_path.trim()),\n        ));\n    }\n    if opts.mode == \"loudness\" || opts.mode == \"both\" {\n        let m = measure(ffmpeg, inp, &measure_filter(target_i, target_tp)).await?;\n        chain.push(apply_filter(&m, target_i, target_tp));\n        measured = Some(m);\n    }\n    if chain.is_empty() {\n        return Err(anyhow!(\"nenhuma operação escolhida\"));\n    }\n    let filter = chain.join(\",\");\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(|| \"audio\".into());\n    let ext = if has_video {\n        inp.extension()\n            .map(|e| e.to_string_lossy().to_string())\n            .unwrap_or_else(|| \"mp4\".into())\n    } else if opts.audio_format.trim().is_empty() {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/audio_clean.rs#L182-L218","documentation":"clean_one builds a filter chain from the selected mode; if neither denoise nor loudness produced a filter (mode not in {denoise, loudness, both} or equivalent), the chain is empty and it errors with \"nenhuma operação escolhida\". This is a guard against running ffmpeg with an empty -af argument.","triggerScenarios":"run -> clean_one with CleanOptions.mode set to an unrecognized string or left empty, so neither the loudness nor denoise branch pushes a filter.","commonSituations":"Typo in mode value (e.g. \"normalise\" vs \"loudness\"); mode field not populated from UI/config; new mode added upstream but not mapped in clean_one.","solutions":["Set opts.mode to one of the supported values (denoise | loudness | both)","Validate the mode string when constructing CleanOptions and reject unknown values early","Log the incoming mode value to spot client/config mismatches","Add an exhaustive match on mode so unknown values fail at parse time"],"exampleFix":"// before\nif chain.is_empty() {\n    return Err(anyhow!(\"nenhuma operação escolhida\"));\n}\n// after\nif chain.is_empty() {\n    return Err(anyhow!(\"nenhuma operação escolhida: modo inválido '{}', use 'denoise', 'loudness' ou 'both'\", opts.mode));\n}","handlingStrategy":"validation","validationCode":"// Validate the mode before constructing CleanOptions\nconst VALID_MODES: [&str; 3] = [\"denoise\", \"loudness\", \"both\"];\nanyhow::ensure!(VALID_MODES.contains(&opts.mode.as_str()), \"invalid mode '{}' — expected denoise|loudness|both\", opts.mode);","typeGuard":null,"tryCatchPattern":"match clean_one(&ffmpeg, &opts, &input).await {\n    Err(e) if e.to_string().contains(\"nenhuma operação escolhida\") => {\n        return Err(anyhow!(\"no cleaning mode selected; set mode to denoise, loudness or both\"));\n    }\n    other => other,\n}","preventionTips":["Model mode as an enum instead of a free String","Validate CleanOptions at deserialization time","Keep UI mode values in sync with backend expectations","Fail fast with a clear message listing allowed values"],"tags":["validation","configuration","audio","rust"],"backgroundTag":"invalid-enum-value","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"}