tonhowtf/omniget · error
escolha o spritesheet
Error message
escolha o spritesheet
What it means
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.
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.
Example fix
// before
let result = image_sprite::run(&opts, &progress); // opts.input empty
// after
if opts.input.as_os_str().is_empty() || !opts.input.exists() {
return Err(anyhow!("selecione um spritesheet antes de fatiar"));
}
let result = image_sprite::run(&opts, &progress); Defensive patterns
Strategy: validation
Validate before calling
fn has_input(opts: &SpriteOptions) -> bool {
let files = gather(opts);
!files.is_empty()
}
// call run() only if has_input(&opts) Try / catch
match image_sprite::run(&opts, &progress) {
Err(e) if e.to_string().contains("escolha o spritesheet") => prompt_file_picker(),
other => other?,
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
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 os quadros
- escolha as imagens ou a pasta
- escolha pelo menos um print
- escolha a pasta de destino para organizar
- informe um appid, um link da loja ou marque a biblioteca…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/6588d3237251d418.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/image_sprite.rs:344
}
serde_json::to_string_pretty(&serde_json::json!({
"frames": serde_json::Value::Object(map),
"meta": {
"app": "OmniGet",
"image": sheet,
"format": "RGBA8888",
"size": { "w": w, "h": h },
"scale": "1"
}
}))
.unwrap_or_else(|_| "{}".into())
}
fn slice(opts: &SpriteOptions, progress: &ProgressFn) -> anyhow::Result<SpriteResult> {
let files = gather(opts);
let input = files
.first()
.ok_or_else(|| anyhow!("escolha o spritesheet"))?;
let sheet = image::open(input)
.map_err(|e| anyhow!("não abri {}: {}", input.display(), e))?
.to_rgba8();
let grid = Grid {
cols: opts.cols,
rows: opts.rows,
cell_w: opts.cell_w,
cell_h: opts.cell_h,
margin: opts.margin,
spacing: opts.spacing,
};
let cells = grid_cells(sheet.width(), sheet.height(), &grid);
if cells.is_empty() {
return Err(anyhow!("a grade não cabe nessa folha"));
}
let stem = if opts.name.trim().is_empty() {
inputView on GitHub (pinned to 8600b91f42)