tonhowtf/omniget · error

nenhum arquivo de áudio para procurar letra

Error message

nenhum arquivo de áudio para procurar letra

What it means

The lyrics tool collects its audio inputs from the provided options before starting. If the resulting input list is empty there is no file to search lyrics for, so it aborts immediately with this message.

Solutions

  1. Pass at least one supported audio file or a directory containing audio files in the options
  2. Verify the configured paths exist and use supported audio extensions
  3. Check that CLI/config values are actually copied into LyricsOptions before calling run
  4. Log collect_inputs results (or count files beforehand) to confirm inputs are non-empty

Example fix

// before
let opts = LyricsOptions { ..Default::default() }; // no inputs
run(opts, progress).await?;
// after
let opts = LyricsOptions { files: vec![audio_path], ..Default::default() };
assert!(!collect_inputs(&opts).is_empty());
run(opts, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

let inputs = collect_inputs(&opts);
if inputs.is_empty() {
    return Err(anyhow!("forneça ao menos um arquivo de áudio"));
}

Type guard

fn has_audio_inputs(opts: &LyricsOptions) -> bool {
    !collect_inputs(opts).is_empty()
}

Try / catch

match lyrics::run(opts, progress).await {
    Err(e) if e.to_string().contains("nenhum arquivo de áudio") => eprintln!("adicione arquivos de áudio às opções"),
    Err(e) => return Err(e),
    Ok(r) => handle(r),
}

Prevention

When it happens

Trigger: Calling the lyrics `run` function with options that resolve to zero audio files — no files/directories given, paths pointing at nothing audio-related, or all inputs filtered out.

Common situations: Forgetting to set the input file/directory option; passing a directory with no supported audio extensions; typo in the path so collect_inputs finds nothing; CLI flag not wired to the options struct.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/music/lyrics.rs:432

            let p = entry.path();
            let audio = p
                .extension()
                .map(|e| AUDIO_EXTS.contains(&e.to_string_lossy().to_lowercase().as_str()))
                .unwrap_or(false);
            if entry.file_type().is_file() && audio {
                out.push(p.to_path_buf());
            }
        }
    }
    out.sort();
    out.dedup();
    out
}

pub async fn run(opts: LyricsOptions, p: ProgressFn) -> Result<LyricsResult> {
    let inputs = collect_inputs(&opts);
    if inputs.is_empty() {
        anyhow::bail!("nenhum arquivo de áudio para procurar letra");
    }
    let http = client()?;
    let total = inputs.len() as u64;
    report(&p, TOOL_ID, "started", 0, Some(total), None);

    let mut result = LyricsResult {
        total: inputs.len(),
        synced: 0,
        plain: 0,
        estimated: 0,
        not_found: 0,
        tracks: Vec::new(),
    };

    for (i, path) in inputs.iter().enumerate() {
        let meta = guess_meta(path);
        let stem = path
            .file_stem()

View on GitHub (pinned to 8600b91f42)