openai/codex · error · anyhow::Error

pet frame dimensions and grid counts must be non-zero

Error message

pet frame dimensions and grid counts must be non-zero

What it means

Manifest guard in validate_frame_spec (reached via load_pet_manifest): a frame entry in the pet spritesheet manifest declared zero for width, height, columns, or rows. A zero dimension would divide/multiply degenerately when computing frame geometry, so the manifest is rejected upfront.

Solutions

  1. Fix the pet manifest JSON so every frame spec has positive width, height, columns, and rows
  2. Regenerate the manifest from the spritesheet tooling so grid values match the image
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/tui/src/pets/model.rs:333 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/df532a51048ffb4d. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/tui/src/pets/model.rs:333

    let (width, height) =
        image::image_dimensions(path).with_context(|| format!("read {}", path.display()))?;
    if width != catalog::SPRITESHEET_WIDTH || height != catalog::SPRITESHEET_HEIGHT {
        bail!(
            "spritesheet must be {}x{} pixels",
            catalog::SPRITESHEET_WIDTH,
            catalog::SPRITESHEET_HEIGHT
        );
    }
    Ok((width, height))
}

fn validate_frame_spec(
    frame: &FrameSpec,
    spritesheet_width: u32,
    spritesheet_height: u32,
) -> Result<usize> {
    if frame.width == 0 || frame.height == 0 || frame.columns == 0 || frame.rows == 0 {
        bail!("pet frame dimensions and grid counts must be non-zero");
    }

    let total_width = frame
        .width
        .checked_mul(frame.columns)
        .context("pet frame grid width overflow")?;
    let total_height = frame
        .height
        .checked_mul(frame.rows)
        .context("pet frame grid height overflow")?;
    if total_width != spritesheet_width || total_height != spritesheet_height {
        bail!(
            "pet frame grid must cover spritesheet exactly: expected {spritesheet_width}x{spritesheet_height}, got {total_width}x{total_height}"
        );
    }

    let frame_count = frame
        .columns

View on GitHub (pinned to 339751715c)