tonhowtf/omniget · error
no máximo trechos por envio
Error message
no máximo {} trechos por envio What it means
Guard in `validate_segments` limiting submissions to MAX_SEGMENTS_PER_SUBMIT segments. SponsorBlock submissions carry a bounded number of segments per request; exceeding the constant is rejected locally to avoid wasting a rate-limited attempt.
Solutions
- Split the submission into multiple payloads of at most MAX_SEGMENTS_PER_SUBMIT segments each.
- Deduplicate and merge overlapping segments before validating.
- Check MAX_SEGMENTS_PER_SUBMIT in the source and cap the UI's segment count to that value.
Example fix
// before
validate_segments(&all_segments, duration)?;
// after
for chunk in all_segments.chunks(MAX_SEGMENTS_PER_SUBMIT) {
validate_segments(chunk, duration)?;
} Defensive patterns
Strategy: validation
Validate before calling
assert!(segments.len() <= MAX_SEGMENTS_PER_SUBMIT, "too many segments for one submit");
Prevention
- Cap the UI's segment count at MAX_SEGMENTS_PER_SUBMIT.
- Chunk large imports into multiple submissions.
- Deduplicate/merge overlapping segments first.
When it happens
Trigger: Calling `validate_segments` (or `build_payload`) with more segments than MAX_SEGMENTS_PER_SUBMIT in the slice — typically a batched import or a user who marked many segments at once.
Common situations: Bulk-importing segments exported from another tool; automation looping and appending duplicate segments; users marking dozens of chapter/sponsor ranges in one go.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- dois trechos se sobrepõem em
- marque pelo menos um trecho antes de enviar
- não reconheci o vídeo do YouTube
- trecho : capítulo precisa de um título
- trecho : categoria desconhecida ( )
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/541c422242f3149e.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/sponsorblock.rs:211
#[serde(default = "default_action")]
pub action_type: String,
/// Só o capítulo usa: é o título que aparece na barra.
#[serde(default)]
pub description: String,
}
fn default_action() -> String {
"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_typeView on GitHub (pinned to 8600b91f42)