tonhowtf/omniget · warning

texto vazio

Error message

texto vazio

What it means

synthesize splits opts.text into chunks via split_text; if the result is empty the function cannot produce any audio and throws this error immediately. It is an input-validation guard meaning no synthesizable text was supplied.

Solutions

  1. Ensure opts.text is non-empty and contains real characters before calling synthesize
  2. Trim and validate user input at the application boundary
  3. Return a friendly validation message to the user instead of letting the backend fail

Example fix

// before
edge_tts::synthesize(&TtsOptions { text: user_text, ..opts }, &path, progress).await?;
// after
let text = user_text.trim();
if text.is_empty() {
    return Err(anyhow!("informe um texto para sintetizar"));
}
edge_tts::synthesize(&TtsOptions { text: text.to_string(), ..opts }, &path, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

if opts.text.trim().is_empty() {
    return Err(anyhow!("texto para TTS nao pode ser vazio"));
}

Try / catch

match edge_tts::synthesize(&opts, &path, progress).await {
    Ok(r) => r,
    Err(e) if e.to_string() == "texto vazio" => { user_facing_error("informe um texto"); Default::default() }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling synthesize() with TtsOptions.text being empty, whitespace-only, or containing only characters that split_text strips out.

Common situations: Empty string field in UI/config; text extracted from a document that turned out to be blank; accidental whitespace-only input; caller forgetting to set opts.text before invoking synthesize.

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/077462f827f28369. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/edge_tts.rs:366

            if buf.len() >= 8 || gap > 600 {
                flush(&mut buf, &mut cues);
            }
        }
        buf.push(w);
    }
    flush(&mut buf, &mut cues);
    cues
}

/// Sintetiza `opts.text` inteiro em `audio_path` (MP3) e escreve o SRT ao lado.
pub async fn synthesize(
    opts: TtsOptions,
    audio_path: &std::path::Path,
    progress: super::ProgressFn,
) -> anyhow::Result<TtsResult> {
    let chunks = split_text(&opts.text);
    if chunks.is_empty() {
        return Err(anyhow!("texto vazio"));
    }
    let id = format!("tts:{}", audio_path.display());
    let mut audio = Vec::new();
    let mut words: Vec<WordBoundary> = Vec::new();
    let mut offset_ms: u64 = 0;
    let mut skew: i64 = 0;
    for (i, chunk) in chunks.iter().enumerate() {
        super::report(
            &progress,
            &id,
            "synthesize",
            i as u64,
            Some(chunks.len() as u64),
            None,
        );
        let out = match synth_chunk(chunk, &opts, skew).await {
            Ok(o) => o,
            Err(e) => {

View on GitHub (pinned to 8600b91f42)