{"record":{"id":"db575a172ba41b81","repo":"nexu-io/open-design","slug":"expected-atlas-size-0-x-atlas-size-1-got-ima","errorCode":null,"errorMessage":"expected {ATLAS_SIZE[0]}x{ATLAS_SIZE[1]}, got {image.width}x{image.height}","messagePattern":"expected (.+?)x(.+?), got (.+?)x(.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/package_custom_pet.py","lineNumber":32,"sourceCode":"\nATLAS_SIZE = (1536, 1872)\n\n\ndef default_codex_home() -> Path:\n    return Path(os.environ.get(\"CODEX_HOME\") or \"~/.codex\").expanduser().resolve()\n\n\ndef slugify(value: str) -> str:\n    value = value.strip().lower()\n    value = re.sub(r\"[^a-z0-9]+\", \"-\", value)\n    value = re.sub(r\"-{2,}\", \"-\", value)\n    return value.strip(\"-\")\n\n\ndef validate_spritesheet(path: Path) -> str:\n    with Image.open(path) as image:\n        if image.size != ATLAS_SIZE:\n            raise SystemExit(\n                f\"expected {ATLAS_SIZE[0]}x{ATLAS_SIZE[1]}, got {image.width}x{image.height}\"\n            )\n        if image.format not in {\"PNG\", \"WEBP\"}:\n            raise SystemExit(f\"expected PNG or WebP, got {image.format}\")\n        return str(image.format)\n\n\ndef write_webp_spritesheet(source: Path, target: Path, source_format: str) -> None:\n    if source_format == \"WEBP\":\n        shutil.copy2(source, target)\n        return\n    with Image.open(source) as image:\n        target.parent.mkdir(parents=True, exist_ok=True)\n        image.convert(\"RGBA\").save(\n            target,\n            format=\"WEBP\",\n            lossless=True,\n            quality=100,","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/package_custom_pet.py#L14-L50","documentation":"Raised by validate_spritesheet in package_custom_pet.py when the opened spritesheet's pixel size does not equal ATLAS_SIZE (1536x1872). The Codex pet atlas contract requires exactly 8 columns x 9 rows of 192x208 cells, so any other dimensions are rejected before packaging.","triggerScenarios":"Passing a spritesheet that was exported at a different resolution, with the wrong row/column count, with non-uniform cell sizing, or a single-frame image.","commonSituations":"Hand-authored art exported at 1024x1024 or another common model output size; a spritesheet built against an older atlas layout; an image that was upscaled/downscaled; using a generated base sprite (1024x1024 default) directly instead of assembling the full atlas.","solutions":["Re-export the spritesheet at exactly 1536x1872 with 8 columns x 9 rows of 192x208 cells.","If you only have the base sprite, run the full prepare_pet_run.py + generate_pet_images.py pipeline to produce all row strips, then assemble them into the 1536x1872 atlas.","Verify with: python -c \"from PIL import Image; print(Image.open('sheet.png').size)\".","Re-run package_custom_pet.py with the corrected sheet."],"exampleFix":"// before\npython package_custom_pet.py --spritesheet base.png ...\n# SystemExit: expected 1536x1872, got 1024x1024\n\n// after - resize is NOT enough; rebuild the full atlas\n# produce all states, then assemble into a 1536x1872 (8 cols x 9 rows of 192x208) sheet\npython package_custom_pet.py --spritesheet full_atlas.png ...","handlingStrategy":"validation","validationCode":"from PIL import Image\n\nATLAS_SIZE = (1536, 1872)\n\ndef check_size(path):\n    with Image.open(path) as im:\n        if im.size != ATLAS_SIZE:\n            raise SystemExit(f\"expected {ATLAS_SIZE[0]}x{ATLAS_SIZE[1]}, got {im.size[0]}x{im.size[1]}\")","typeGuard":"def is_atlas_size(path) -> bool:\n    with Image.open(path) as im:\n        return im.size == (1536, 1872)","tryCatchPattern":null,"preventionTips":["Author spritesheets against the documented 8x9 grid of 192x208 cells (1536x1872).","Run the full prepare_pet_run.py + generate_pet_images.py pipeline; do not package a single base sprite as the atlas.","Add a pre-commit check that asserts spritesheet dimensions before packaging."],"tags":["spritesheet","atlas","image-dimensions","validation","pillow"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}