{"record":{"id":"52a0756045c92d9e","repo":"tonhowtf/omniget","slug":"modo-desconhecido","errorCode":null,"errorMessage":"modo desconhecido: {}","messagePattern":"modo desconhecido: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_sprite.rs","lineNumber":616,"sourceCode":"    Ok(SpriteResult {\n        mode: \"batch\".into(),\n        count: outputs.len() as u32,\n        outputs,\n        frames,\n        sheet: None,\n        atlas: None,\n        width: 0,\n        height: 0,\n        skipped,\n    })\n}\n\npub fn run(opts: &SpriteOptions, progress: &ProgressFn) -> anyhow::Result<SpriteResult> {\n    match opts.mode.as_str() {\n        \"slice\" => slice(opts, progress),\n        \"pack\" => pack(opts, progress),\n        \"batch\" => batch(opts, progress),\n        other => Err(anyhow!(\"modo desconhecido: {}\", other)),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn solid(w: u32, h: u32, c: [u8; 4]) -> RgbaImage {\n        RgbaImage::from_pixel(w, h, image::Rgba(c))\n    }\n\n    /// Quadro com um pixel diferente em cada canto, para o round-trip pegar\n    /// qualquer deslocamento de um px.\n    fn frame(i: u32) -> RgbaImage {\n        let mut img = solid(16, 16, [(i * 20) as u8, 40, 200 - (i * 7) as u8, 255]);\n        img.put_pixel(0, 0, image::Rgba([255, 255, 255, 255]));\n        img.put_pixel(15, 15, image::Rgba([0, 0, 0, 255]));\n        img","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_sprite.rs#L598-L634","documentation":"Thrown by SpriteOptions::run when opts.mode is not one of \"slice\", \"pack\", or \"batch\". The mode string is dispatched with match on as_str(); anything else yields this error including the offending value.","triggerScenarios":"Calling image_sprite::run with SpriteOptions.mode set to a typo (e.g. \"Slice\", \"slices\"), a localized string, or a stale serialized value from an older config/UI version.","commonSituations":"UI sending an untranslated mode label; persisted settings from a renamed mode; hand-written test or CLI input using the wrong casing.","solutions":["Set opts.mode to exactly \"slice\", \"pack\", or \"batch\" (lowercase).","Normalize/validate the mode string at the boundary (UI/form) before constructing SpriteOptions.","If migrating from older configs, map legacy mode names to the new ones.","Parse the mode into an enum instead of free-form string to make invalid values unrepresentable."],"exampleFix":"// before\nlet opts = SpriteOptions { mode: \"Slice\".into(), .. };\nimage_sprite::run(&opts, &progress)?; // modo desconhecido: Slice\n// after\nlet mode = mode.to_lowercase();\nassert!(matches!(mode.as_str(), \"slice\" | \"pack\" | \"batch\"));\nlet opts = SpriteOptions { mode, .. };\nimage_sprite::run(&opts, &progress)?;","handlingStrategy":"type-guard","validationCode":"fn is_valid_mode(m: &str) -> bool { matches!(m, \"slice\" | \"pack\" | \"batch\") }\n// call run() only if is_valid_mode(&opts.mode)","typeGuard":"enum SpriteMode { Slice, Pack, Batch }\nfn parse_mode(m: &str) -> Option<SpriteMode> {\n    match m {\n        \"slice\" => Some(SpriteMode::Slice),\n        \"pack\" => Some(SpriteMode::Pack),\n        \"batch\" => Some(SpriteMode::Batch),\n        _ => None,\n    }\n}","tryCatchPattern":"match image_sprite::run(&opts, &progress) {\n    Err(e) if e.to_string().starts_with(\"modo desconhecido\") => {\n        eprintln!(\"use slice, pack ou batch (recebido: {e})\");\n    }\n    other => other?,\n}","preventionTips":["Store the mode as an enum, not a free-form string.","Lowercase/trim mode input at the boundary.","Validate persisted configs when loading old settings.","Use exhaustive match so the compiler forces new modes to be handled."],"tags":["invalid-argument","dispatch","spritesheet","rust"],"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-15T23:17:13.987Z"}