tonhowtf/omniget · error
formato desconhecido
Error message
formato desconhecido: {} What it means
export() validates each requested output format against a fixed set (json, csv, srt, ass, vtt). Any format string outside that set reaches the catch-all `other =>` arm and bails with "formato desconhecido: {}". The library does not pre-validate formats, so the error surfaces only when rendering files.
Solutions
- Use only the supported formats: json, csv, srt, ass, vtt (case-insensitive).
- Fix the formats value in your config/CLI invocation — check for typos and stray whitespace.
- Validate format strings against the allowed list before calling export().
Example fix
// before
let opts = ChatOpts { formats: vec!["txt".into()], ..Default::default() }; // bail: formato desconhecido: txt
// after
let allowed = ["json", "csv", "srt", "ass", "vtt"];
let formats: Vec<String> = vec!["txt".into()]
.into_iter()
.filter(|f| allowed.contains(&f.to_lowercase().as_str()))
.collect();
let opts = ChatOpts { formats, ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: [&str; 5] = ["json", "csv", "srt", "ass", "vtt"];
fn validate_formats(formats: &[String]) -> Result<(), String> {
formats.iter()
.find(|f| !SUPPORTED.contains(&f.to_lowercase().as_str()))
.map(|f| Err(format!("formato desconhecido: {}", f)))
.unwrap_or(Ok(()))
} Prevention
- Whitelist formats at config-parse time (json, csv, srt, ass, vtt).
- Normalize case and trim whitespace when accepting format strings from users.
- Avoid hardcoding format lists copied from other tools.
- Add an integration test asserting every configured format is accepted.
When it happens
Trigger: Calling export() with opts.formats containing anything other than "json", "csv", "srt", "ass", or "vtt" (case-insensitive) — e.g. "txt", "xml", "JSONL", or a locale-mangled value.
Common situations: Users typing an intuitive but unsupported extension like "text" or "ssa" in a config file; copying format names from another tool; passing a comma-separated string instead of individual format entries.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Twitch recusou o replay de chat
- esse VOD não devolveu nenhuma mensagem de chat
- Track sem soundcloud_id
- SoundCloud nao retornou URL
- Spotify SDK device not ready
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/dda5455fbb9b3177.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/twitch/chat.rs:551
serde_json::to_string_pretty(&json!({
"video": {
"id": info.id,
"title": info.title,
"channel": info.channel,
"channel_display": info.channel_display,
"created_at": info.created_at,
"duration_seconds": info.duration_seconds,
},
"messages": messages,
"peaks_per_minute": series,
}))?,
),
"csv" => ("csv", to_csv(&messages)),
"srt" | "ass" | "vtt" => {
let cues = to_cues(&messages, opts.window_seconds, opts.max_lines);
(format.as_str(), subtitle::render(&cues, format))
}
other => bail!("formato desconhecido: {}", other),
};
let path = dir.join(format!("{}.{}", stem, ext));
std::fs::write(&path, body)?;
files.push(path.to_string_lossy().to_string());
}
let sample = messages.iter().take(30).cloned().collect();
Ok(Result {
video_id: info.id,
title: info.title,
channel: if info.channel_display.is_empty() {
info.channel
} else {
info.channel_display
},
duration_seconds: info.duration_seconds,
messages: messages.len(),
pages,View on GitHub (pinned to 8600b91f42)