tonhowtf/omniget · error
trecho : categoria desconhecida ( )
Error message
trecho {}: categoria desconhecida ({}) What it means
Per-segment enum check in `validate_segments`: each segment's category must be one of the strings in the CATEGORIES whitelist (the SponsorBlock category set the library supports). Any other string fails with the 1-based segment number and the offending value.
Solutions
- Use a category string from the library's CATEGORIES list (check the constant in sponsorblock.rs) exactly, lowercase.
- Copy category names from the SponsorBlock API docs matching the library's supported version.
- Trim/normalize user input to lowercase before constructing NewSegment.
- If a legitimate new category is missing, add it to CATEGORIES.
Example fix
// before
NewSegment { category: "Sponsor".into(), .. };
// after
NewSegment { category: "sponsor".into(), .. }; Defensive patterns
Strategy: validation
Validate before calling
const CATEGORIES: &[&str] = &["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler", "chapter"];
assert!(CATEGORIES.contains(&seg.category.as_str()), "unknown category: {}", seg.category); Type guard
fn is_valid_category(c: &str) -> bool {
CATEGORIES.contains(&c.to_lowercase().trim())
} Prevention
- Copy category strings from the library's CATEGORIES constant, lowercase.
- Trim+lowercase user input before building NewSegment.
- Don't invent category names from memory — check the SponsorBlock docs version the library targets.
When it happens
Trigger: Calling `validate_segments`/`build_payload` with a segment whose `category` is misspelled, capitalized differently (e.g. "Sponsor"), or simply not in CATEGORIES (e.g. " filler", "highlight" if unsupported).
Common situations: Hand-writing category strings instead of copying the constants; importing segments from another tool with different category names; locale-mangled strings; older/newer SponsorBlock category names than the library's list.
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
- trecho : tipo de ação desconhecido ( )
- dois trechos se sobrepõem em
- marque pelo menos um trecho antes de enviar
- não reconheci o vídeo do YouTube
- no máximo trechos por envio
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/1a00578bbf4c7c16.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/sponsorblock.rs:219
"skip".to_string()
}
/// Recusa o que o servidor recusaria, com a mensagem em português e antes de
/// gastar um envio (o limite de taxa é por conta, não por tentativa válida).
pub fn validate_segments(segments: &[NewSegment], duration: f64) -> anyhow::Result<()> {
if segments.is_empty() {
return Err(anyhow!("marque pelo menos um trecho antes de enviar"));
}
if segments.len() > MAX_SEGMENTS_PER_SUBMIT {
return Err(anyhow!(
"no máximo {} trechos por envio",
MAX_SEGMENTS_PER_SUBMIT
));
}
for (i, s) in segments.iter().enumerate() {
let n = i + 1;
if !CATEGORIES.contains(&s.category.as_str()) {
return Err(anyhow!(
"trecho {}: categoria desconhecida ({})",
n,
s.category
));
}
if !ACTION_TYPES.contains(&s.action_type.as_str()) {
return Err(anyhow!(
"trecho {}: tipo de ação desconhecido ({})",
n,
s.action_type
));
}
if !s.start.is_finite() || !s.end.is_finite() || s.start < 0.0 || s.end < 0.0 {
return Err(anyhow!("trecho {}: tempo inválido", n));
}
let pontual = s.action_type == "poi" || s.action_type == "full";
if !pontual && s.end <= s.start {
return Err(anyhow!("trecho {}: o fim tem de vir depois do começo", n));View on GitHub (pinned to 8600b91f42)