tonhowtf/omniget · error
trecho : capítulo precisa de um título
Error message
trecho {}: capítulo precisa de um título What it means
validate_segments requires every segment with action_type "chapter" to carry a non-empty (after trim) description, because a YouTube chapter is displayed by its title. A chapter with a blank title would be invisible/useless on the SponsorBlock API, so the library refuses to build the payload.
Solutions
- Set a non-empty description on every chapter segment before calling build_payload.
- Fall back to a generated title (e.g. the formatted timestamp) when the user leaves it blank.
- If the segment is not really a chapter, change its action_type instead of leaving it as "chapter".
- Validate in the UI: require the title field when the chapter category is selected.
Example fix
// before
NewSegment { action_type: "chapter".into(), description: "".into(), .. }
// after
NewSegment { action_type: "chapter".into(), description: "Introdução".into(), .. } Defensive patterns
Strategy: validation
Validate before calling
fn chapter_has_title(s: &NewSegment) -> bool {
s.action_type != "chapter" || !s.description.trim().is_empty()
} Type guard
fn is_titled_chapter(s: &NewSegment) -> bool {
!(s.action_type == "chapter" && s.description.trim().is_empty())
} Try / catch
match build_payload(&id, &user, dur, &segs) {
Err(e) if e.to_string().contains("capítulo precisa de um título") => prompt_for_missing_title()?,
other => other?,
} Prevention
- Make the title field mandatory in the UI when the chapter category is selected.
- Generate a default title from the timestamp when the user leaves it blank.
- Trim descriptions before storing segments.
When it happens
Trigger: Calling build_payload/submit with a chapter segment whose description is "", " ", or only whitespace/newlines.
Common situations: A UI where the title field is optional but the user picked the 'chapter' category; batch imports where chapter titles were in a column that was never mapped; pasting timestamps without titles.
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
- escolha a pasta da biblioteca de destino
- trecho : o fim tem de vir depois do começo
- trecho : passa do fim do vídeo
- dois trechos se sobrepõem em
- não reconheci o vídeo do YouTube
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/cc981feff83018a2.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/sponsorblock.rs:240
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));
}
if s.action_type == "chapter" && s.description.trim().is_empty() {
return Err(anyhow!("trecho {}: capítulo precisa de um título", n));
}
if duration > 0.0 && s.end > duration + 1.0 {
return Err(anyhow!("trecho {}: passa do fim do vídeo", n));
}
}
// Sobreposição só importa entre trechos que pulam pedaço.
let mut cortes: Vec<&NewSegment> = segments
.iter()
.filter(|s| s.action_type == "skip" || s.action_type == "mute")
.collect();
cortes.sort_by(|a, b| a.start.total_cmp(&b.start));
for par in cortes.windows(2) {
if par[1].start < par[0].end {
return Err(anyhow!("dois trechos se sobrepõem em {:.1}s", par[1].start));
}
}
Ok(())
}View on GitHub (pinned to 8600b91f42)