Hmbown/CodeWhale · error · SystemExit

unexpected founder sheet geometry

Error message

unexpected founder sheet geometry: {image.size}

What it means

After loading the founder sheet, `load_sheet()` validates geometry: the image must be square (`width == height`) and at least 800px wide. This SystemExit fires when the raster has unexpected dimensions, since the fractional search bands and hero detection assume the sheet layout.

Solutions

  1. Check the actual dimensions with `python -c "from PIL import Image; print(Image.open('brand/codewhalemarkfinal.png').size)"`
  2. Restore the original square founder sheet (>=800x800) from git history or the design source
  3. Re-export the raster at full square resolution and overwrite brand/codewhalemarkfinal.png
  4. If git-lfs is in use, confirm the real binary was fetched, not a small pointer/preview

Example fix

# before
Image.open('brand/codewhalemarkfinal.png').size  # (512, 640)
# after: replace with the square sheet
Image.open('brand/codewhalemarkfinal.png').size  # (2048, 2048)
Defensive patterns

Strategy: validation

Validate before calling

from PIL import Image
w, h = Image.open("brand/codewhalemarkfinal.png").size
assert w == h and w >= 800, f"sheet must be square and >=800px, got {(w, h)}"

Try / catch

try:
    main()
except SystemExit as e:
    if "unexpected founder sheet geometry" in str(e):
        raise SystemExit("restore the original square founder sheet (>=800px) from design source")

Prevention

When it happens

Trigger: `load_sheet()` (called by `write_png`/`main`) opens a `brand/codewhalemarkfinal.png` whose width != height or whose width < 800 pixels at scripts/brand/braille-mark.py:77.

Common situations: A placeholder, thumbnail, or re-exported crop replaced the original sheet; git-lfs pointers fetched at reduced size; someone replaced the raster with a differently sized variant; downloading a preview image instead of the full asset.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/691dd7d5f66c50e4. Report an issue: GitHub.

Appendix: source

Thrown at scripts/brand/braille-mark.py:77

    (1, 1): 0x10,
    (2, 1): 0x20,
    (3, 0): 0x40,
    (3, 1): 0x80,
}


def is_navy(pixel: tuple[int, int, int]) -> bool:
    r, g, b = pixel
    return b > 60 and b > r + 25 and r < 110 and g < 150


def load_sheet() -> Image.Image:
    if not RASTER.exists():
        raise SystemExit(f"founder raster missing: {RASTER}")
    image = Image.open(RASTER).convert("RGB")
    width, height = image.size
    if width != height or width < 800:
        raise SystemExit(f"unexpected founder sheet geometry: {image.size}")
    return image


def band_box(image: Image.Image, band: tuple[float, float, float, float]):
    width, height = image.size
    return (
        int(band[0] * width),
        int(band[1] * width),
        int(band[2] * height),
        int(band[3] * height),
    )


def hero_coverage(image: Image.Image) -> tuple[int, int, list[list[float]]]:
    """Navy-darkness coverage of the hero whale crop, each in 0..1."""
    width, height = image.size
    x0, x1, y0, _ = band_box(image, HERO_BAND)
    pixels = image.load()

View on GitHub (pinned to 433685b202)