{"record":{"id":"e5ddfc99d06317a5","repo":"tonhowtf/omniget","slug":"trecho-tipo-de-a-o-desconhecido","errorCode":null,"errorMessage":"trecho {}: tipo de ação desconhecido ({})","messagePattern":"trecho (.+?): tipo de ação desconhecido \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/sponsorblock.rs","lineNumber":226,"sourceCode":"        return Err(anyhow!(\"marque pelo menos um trecho antes de enviar\"));\n    }\n    if segments.len() > MAX_SEGMENTS_PER_SUBMIT {\n        return Err(anyhow!(\n            \"no máximo {} trechos por envio\",\n            MAX_SEGMENTS_PER_SUBMIT\n        ));\n    }\n    for (i, s) in segments.iter().enumerate() {\n        let n = i + 1;\n        if !CATEGORIES.contains(&s.category.as_str()) {\n            return Err(anyhow!(\n                \"trecho {}: categoria desconhecida ({})\",\n                n,\n                s.category\n            ));\n        }\n        if !ACTION_TYPES.contains(&s.action_type.as_str()) {\n            return Err(anyhow!(\n                \"trecho {}: tipo de ação desconhecido ({})\",\n                n,\n                s.action_type\n            ));\n        }\n        if !s.start.is_finite() || !s.end.is_finite() || s.start < 0.0 || s.end < 0.0 {\n            return Err(anyhow!(\"trecho {}: tempo inválido\", n));\n        }\n        let pontual = s.action_type == \"poi\" || s.action_type == \"full\";\n        if !pontual && s.end <= s.start {\n            return Err(anyhow!(\"trecho {}: o fim tem de vir depois do começo\", n));\n        }\n        if s.action_type == \"chapter\" && s.description.trim().is_empty() {\n            return Err(anyhow!(\"trecho {}: capítulo precisa de um título\", n));\n        }\n        if duration > 0.0 && s.end > duration + 1.0 {\n            return Err(anyhow!(\"trecho {}: passa do fim do vídeo\", n));\n        }","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/sponsorblock.rs#L208-L244","documentation":"Per-segment enum check in `validate_segments`: each segment's `action_type` must be one of the strings in ACTION_TYPES (the SponsorBlock action whitelist the library supports, e.g. \"skip\", \"mute\", \"full\", \"poi\", \"chapter\"). Unknown values fail with the segment number and offending value.","triggerScenarios":"Calling `validate_segments`/`build_payload` with a segment whose `action_type` is misspelled, wrong-cased, or not in ACTION_TYPES (e.g. \"skip_only\", \"chapter\" if unsupported by the local list).","commonSituations":"Copying action names from a newer/older SponsorBlock API version; typo like \"poi\" vs \"pointOfInterest\" variants; hand-crafted JSON payloads imported from other tools.","solutions":["Use an action_type string present in the library's ACTION_TYPES constant, exactly and lowercase.","Normalize input with trim+lowercase before building NewSegment.","If the server supports a new action type, add it to ACTION_TYPES and rebuild."],"exampleFix":"// before\nNewSegment { action_type: \"Skip\".into(), .. };\n// after\nNewSegment { action_type: \"skip\".into(), .. };","handlingStrategy":"validation","validationCode":"const ACTION_TYPES: &[&str] = &[\"skip\", \"mute\", \"full\", \"poi\", \"chapter\"];\nassert!(ACTION_TYPES.contains(&seg.action_type.as_str()), \"unknown action: {}\", seg.action_type);","typeGuard":"fn is_valid_action(a: &str) -> bool {\n    ACTION_TYPES.contains(&a.to_lowercase().trim())\n}","tryCatchPattern":null,"preventionTips":["Use lowercase action strings from ACTION_TYPES.","Normalize imported payloads before validation.","Check the constant for the exact supported set rather than guessing."],"tags":["validation","enum","sponsorblock"],"backgroundTag":"invalid-enum-value","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}