tonhowtf/omniget · error

a legenda nao tem falas

Error message

a legenda nao tem falas

What it means

dub() reads the SRT subtitle file, parses it into cues, and filters out cues whose text is empty or whitespace-only. If no non-empty cues remain, it refuses to proceed and throws the Portuguese message 'a legenda nao tem falas' ('the subtitle has no lines'). The library throws this because dubbing audio for zero spoken lines is a no-op and would produce a broken/empty output pipeline.

Solutions

  1. Check the SRT file before dubbing: ensure it is a valid, non-empty SubRip file with at least one cue containing dialogue text.
  2. Verify opts.srt_path points to the correct subtitle file for the target media.
  3. If the file is VTT or another format, convert it to SRT (e.g. ffmpeg -i subs.vtt subs.srt) before calling dub.
  4. Strip HTML/formatting tags or fix the encoding (UTF-8 without BOM) so cues parse with non-empty text.
Defensive patterns

Strategy: validation

Validate before calling

let srt = tokio::fs::read_to_string(&opts.srt_path).await?;
let has_dialogue = parse_cues(&srt).iter().any(|c| !c.text.trim().is_empty());
if !has_dialogue {
    anyhow::bail!("SRT at {} has no non-empty cues; refusing to dub", opts.srt_path.display());
}

Try / catch

match dub(opts).await {
    Err(e) if e.to_string().contains("nao tem falas") => {
        // prompt user to select a dialogue-bearing subtitle file
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling dub with opts.srt_path pointing at an SRT file that is empty, contains only sequence/timestamp lines with blank text, contains only whitespace cues, or does not parse into any Cue at all (malformed SRT yielding zero cues).

Common situations: Passing a subtitle file downloaded as an empty stub or ads/notes-only file; passing the wrong file path so a placeholder/empty SRT is read; using an SRT format (e.g. WebVTT or with BOM/HTML tags) the parser cannot read, so parse_cues returns nothing; subtitles that contain only formatting tags stripped to whitespace.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/dub.rs:72

        s /= 2.0;
    }
    while s < 0.5 {
        parts.push("atempo=0.5".to_string());
        s /= 0.5;
    }
    parts.push(format!("atempo={:.4}", s));
    parts.join(",")
}

pub async fn dub(opts: DubOptions, progress: super::ProgressFn) -> anyhow::Result<DubResult> {
    let id = "dub";
    let srt = tokio::fs::read_to_string(&opts.srt_path).await?;
    let cues: Vec<Cue> = parse_cues(&srt)
        .into_iter()
        .filter(|c| !c.text.trim().is_empty())
        .collect();
    if cues.is_empty() {
        return Err(anyhow!("a legenda nao tem falas"));
    }
    let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;
    let work = super::temp_dir().join(format!("dub-{}", uuid::Uuid::new_v4()));
    std::fs::create_dir_all(&work)?;
    let out_dir = if opts.output_dir.trim().is_empty() {
        Path::new(&opts.srt_path)
            .parent()
            .map(|p| p.to_path_buf())
            .unwrap_or_else(|| PathBuf::from("."))
    } else {
        PathBuf::from(opts.output_dir.trim())
    };
    std::fs::create_dir_all(&out_dir)?;
    let stem = Path::new(&opts.srt_path)
        .file_stem()
        .map(|s| s.to_string_lossy().to_string())
        .unwrap_or_else(|| "dublagem".into());

View on GitHub (pinned to 8600b91f42)