Hmbown/CodeWhale · error · SystemExit

app-icon blob has unexpected height

Error message

app-icon blob has unexpected height: {edge}

What it means

After finding the app-icon blob, icon_square computes its height (edge = by1 - by0 + 1) and asserts it falls within 150–260 pixels, because the icon is known to be square and this height defines the crop box. A height outside this range means the located blob is not the app icon (wrong image, changed art, or wrong scale), and the resulting crop would be wrong.

Solutions

  1. Re-export the founder sheet at the resolution the script expects (edge 150–260)
  2. Confirm the largest blob is the icon, not another design element; adjust the flood-fill target color if needed
  3. Inspect the printed blob bounds and scale the sheet accordingly
  4. If the design legitimately changed, update the 150–260 range in icon_square to the new expected icon height

Example fix

# before
if not 150 <= edge <= 260:
    raise SystemExit(f"app-icon blob has unexpected height: {edge}")
# after
if not 150 <= edge <= 260:
    raise SystemExit(
        f"app-icon blob has unexpected height: {edge} "
        "(expected 150-260; is the sheet at the right resolution?)"
    )
Defensive patterns

Strategy: validation

Validate before calling

edge = by1 - by0 + 1
if not (150 <= edge <= 260):
    raise SystemExit(f"icon edge {edge}px out of 150-260; re-export sheet")

Prevention

When it happens

Trigger: Running write_png -> icon_square on a founder sheet where the largest navy blob's vertical extent is <150 or >260 px — e.g. sheet rendered at a different DPI/scale, icon replaced with new art of different size, or a non-icon element (banner, splash) became the largest blob.

Common situations: Retina/1x resolution mismatch in the asset; icon redesign changing proportions; script pointed at a stale or exported-at-wrong-size PNG; blob including extra antialiased rows from a nearby element.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

                        and y0 <= ny < y1
                        and not seen[ny * width + nx]
                        and is_navy(pixels[nx, ny])
                    ):
                        seen[ny * width + nx] = 1
                        stack.append((nx, ny))
            if len(blob) > len(best):
                best = blob
    if len(best) < 10_000:
        raise SystemExit("app-icon blob not found in the founder sheet")
    bx0 = min(x for x, _ in best)
    bx1 = max(x for x, _ in best)
    by0 = min(y for _, y in best)
    by1 = max(y for _, y in best)
    # The white whale cuts the blob's left side, but its full height shows:
    # the icon is square, so the edge is the height.
    edge = by1 - by0 + 1
    if not 150 <= edge <= 260:
        raise SystemExit(f"app-icon blob has unexpected height: {edge}")
    cx = (bx0 + bx1) // 2
    cy = (by0 + by1) // 2
    half = edge // 2 + ICON_PAD
    box = (cx - half, cy - half, cx + half, cy + half)
    print(
        f"// app-icon navy blob x {bx0}-{bx1} y {by0}-{by1}, "
        f"square crop {box[0]},{box[1]}-{box[2]},{box[3]}",
        file=sys.stderr,
    )
    square = image.crop(box).convert("RGBA")
    sw, sh = square.size
    ink = square.load()
    flood = bytearray(sw * sh)

    def is_bg(x: int, y: int) -> bool:
        r, g, b = ink[x, y][:3]
        return min(r, g, b) > BG_CUTOFF

View on GitHub (pinned to 433685b202)