tonhowtf/omniget · error

escolha os quadros

Error message

escolha os quadros

What it means

Empty-input guard in the sprite packer: pack() gathers the input frame files via gather(opts) and, when the resulting list is empty (no frames matched the supplied options/paths), it aborts instead of producing an empty sprite sheet. It fires when the user runs the slice/pack operation without any usable frame images selected.

Solutions

  1. Point SpriteOptions input at a folder or pattern containing at least one image frame.
  2. Check gather()'s accepted extensions and place files accordingly.
  3. Validate non-empty input in the UI/CLI before invoking run().
  4. Treat this error as a prompt-to-select, not a bug report.

Example fix

// before
let files = gather(&opts); // empty
image_sprite::run(&opts, &progress)?;
// after
if gather(&opts).is_empty() {
    anyhow::bail!("selecione os quadros antes de empacotar");
}
image_sprite::run(&opts, &progress)?;
Defensive patterns

Strategy: validation

Validate before calling

fn has_frames(opts: &SpriteOptions) -> bool { !gather(opts).is_empty() }
// call run() only if has_frames(&opts)

Try / catch

match image_sprite::run(&opts, &progress) {
    Err(e) if e.to_string().contains("escolha os quadros") => prompt_frames_selection(),
    other => other?,
}

Prevention

When it happens

Trigger: Calling run() with mode "pack" and an input path/pattern that matches no files (empty folder, nonexistent path, extension filter excluding everything).

Common situations: User submits the pack form without choosing frames; folder is empty or contains only non-image files; wrong working directory in CLI use.

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


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/5f6eec058e0ac9aa. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/image_sprite.rs:439

    super::report(progress, "img-sprite", "done", total, Some(total), None);
    Ok(SpriteResult {
        mode: "slice".into(),
        count: outputs.len() as u32,
        outputs,
        frames,
        sheet: Some(input.to_string_lossy().to_string()),
        atlas: None,
        width: sheet.width(),
        height: sheet.height(),
        skipped,
    })
}

fn pack(opts: &SpriteOptions, progress: &ProgressFn) -> anyhow::Result<SpriteResult> {
    let files = gather(opts);
    if files.is_empty() {
        return Err(anyhow!("escolha os quadros"));
    }
    let total = files.len() as u64;
    let mut images: Vec<(String, RgbaImage)> = Vec::new();
    let mut skipped = 0u32;
    for (i, path) in files.iter().enumerate() {
        super::report(
            progress,
            "img-sprite",
            "progress",
            i as u64,
            Some(total),
            Some(path.to_string_lossy().to_string()),
        );
        match image::open(path) {
            Ok(img) => {
                let name = path
                    .file_name()
                    .map(|s| s.to_string_lossy().to_string())

View on GitHub (pinned to 8600b91f42)