tonhowtf/omniget · error

nenhum quadro pôde ser aberto

Error message

nenhum quadro pôde ser aberto

What it means

Thrown by pack after the per-file loading loop when none of the gathered frame files could be decoded into an RgbaImage (all failed and were skipped with a warning). Some files existed, but every open/decode attempt errored, so there is nothing to pack.

Solutions

  1. Check the tracing::warn! logs — each skipped file's path and decode error is logged there.
  2. Verify the image crate build features cover your formats (png, jpeg, webp, ...).
  3. Open one failing file with `file`/a viewer to confirm it is a valid image.
  4. Fix file permissions or re-export the corrupted images, then rerun pack.

Example fix

// before
for path in files { /* open errors only warn+skip */ }
if images.is_empty() { return Err(anyhow!("nenhum quadro pôde ser aberto")); }
// after
// surface the first decode error to the user instead of a generic message:
return Err(anyhow!("nenhum quadro pôde ser aberto; primeiro erro: {}", first_error));
Defensive patterns

Strategy: validation

Validate before calling

fn all_decode(files: &[std::path::PathBuf]) -> Result<(), std::path::PathBuf> {
    for f in files {
        if image::open(f).is_err() { return Err(f.clone()); }
    }
    Ok(())
}

Try / catch

match image_sprite::run(&opts, &progress) {
    Err(e) if e.to_string().contains("nenhum quadro pôde ser aberto") => {
        // inspect tracing warnings for per-file decode errors
        eprintln!("nenhuma imagem pôde ser decodificada; verifique os formatos");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling run() with mode "pack" where every file in the input list fails image::open — corrupted images, unsupported formats (missing image-crate features), truncated files, or unreadable permissions.

Common situations: Folder of images in a format the binary wasn't built to decode (e.g. avif/heic); zero-byte files from failed downloads; permission-restricted files on shared drives.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

            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())
                    .unwrap_or_else(|| format!("quadro_{:03}", i));
                images.push((name, img.to_rgba8()));
            }
            Err(e) => {
                tracing::warn!("[img-sprite] {}: {}", path.display(), e);
                skipped += 1;
            }
        }
    }
    if images.is_empty() {
        return Err(anyhow!("nenhum quadro pôde ser aberto"));
    }

    let sizes: Vec<(u32, u32)> = images.iter().map(|(_, i)| i.dimensions()).collect();
    let cols = if opts.pack_cols > 0 {
        opts.pack_cols
    } else {
        near_square_cols(images.len() as u32)
    };
    let (w, h, positions) = pack_layout(&sizes, cols, opts.padding);
    let mut sheet = RgbaImage::from_pixel(w, h, image::Rgba([0, 0, 0, 0]));
    let mut frames = Vec::with_capacity(images.len());
    for ((name, img), (x, y)) in images.iter().zip(&positions) {
        imageops::overlay(&mut sheet, img, *x as i64, *y as i64);
        frames.push(SpriteFrame {
            name: name.clone(),
            x: *x,
            y: *y,
            w: img.width(),

View on GitHub (pinned to 8600b91f42)