{"record":{"id":"6588d3237251d418","repo":"tonhowtf/omniget","slug":"escolha-o-spritesheet","errorCode":null,"errorMessage":"escolha o spritesheet","messagePattern":"escolha o spritesheet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_sprite.rs","lineNumber":344,"sourceCode":"    }\n    serde_json::to_string_pretty(&serde_json::json!({\n        \"frames\": serde_json::Value::Object(map),\n        \"meta\": {\n            \"app\": \"OmniGet\",\n            \"image\": sheet,\n            \"format\": \"RGBA8888\",\n            \"size\": { \"w\": w, \"h\": h },\n            \"scale\": \"1\"\n        }\n    }))\n    .unwrap_or_else(|_| \"{}\".into())\n}\n\nfn slice(opts: &SpriteOptions, progress: &ProgressFn) -> anyhow::Result<SpriteResult> {\n    let files = gather(opts);\n    let input = files\n        .first()\n        .ok_or_else(|| anyhow!(\"escolha o spritesheet\"))?;\n    let sheet = image::open(input)\n        .map_err(|e| anyhow!(\"não abri {}: {}\", input.display(), e))?\n        .to_rgba8();\n    let grid = Grid {\n        cols: opts.cols,\n        rows: opts.rows,\n        cell_w: opts.cell_w,\n        cell_h: opts.cell_h,\n        margin: opts.margin,\n        spacing: opts.spacing,\n    };\n    let cells = grid_cells(sheet.width(), sheet.height(), &grid);\n    if cells.is_empty() {\n        return Err(anyhow!(\"a grade não cabe nessa folha\"));\n    }\n\n    let stem = if opts.name.trim().is_empty() {\n        input","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_sprite.rs#L326-L362","documentation":"Thrown by slice when gather(opts) returns no input files, meaning no spritesheet was selected. slice takes the first gathered file, so an empty list makes slicing impossible and the run aborts with this user-facing message.","triggerScenarios":"Calling run() with mode \"slice\" and SpriteOptions whose input path/pattern yields zero files (empty input path, nonexistent folder, pattern matching nothing, or all files filtered out).","commonSituations":"User forgets to pick a file in the UI; input path points to an empty directory; glob pattern typo; file was moved/deleted before the operation ran.","solutions":["Set SpriteOptions input to an existing spritesheet file (or a folder/pattern that matches at least one file).","Check gather()'s matching rules (extensions, recursion) and make sure your file qualifies.","Validate the input exists before calling run() and show a file picker when empty.","Handle this error in the UI as a 'choose a file' prompt rather than a crash."],"exampleFix":"// before\nlet result = image_sprite::run(&opts, &progress); // opts.input empty\n// after\nif opts.input.as_os_str().is_empty() || !opts.input.exists() {\n    return Err(anyhow!(\"selecione um spritesheet antes de fatiar\"));\n}\nlet result = image_sprite::run(&opts, &progress);","handlingStrategy":"validation","validationCode":"fn has_input(opts: &SpriteOptions) -> bool {\n    let files = gather(opts);\n    !files.is_empty()\n}\n// call run() only if has_input(&opts)","typeGuard":null,"tryCatchPattern":"match image_sprite::run(&opts, &progress) {\n    Err(e) if e.to_string().contains(\"escolha o spritesheet\") => prompt_file_picker(),\n    other => other?,\n}","preventionTips":["Validate the input path exists and is a file before calling run().","Show a file picker when no input is selected.","Check gather()'s extension filters against your files.","Never call slice with an empty/default SpriteOptions."],"tags":["missing-input","validation","spritesheet","rust"],"backgroundTag":"empty-required-field","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"}