Significant-Gravitas/AutoGPT · error · HTTPException
Logo must be square. Got {width}x{height}
Error message
Logo must be square. Got {width}x{height} What it means
Returned (400) after Pillow reports the image's dimensions and width != height. Logos must be exactly square; any aspect ratio other than 1:1 is rejected before the min/max size checks.
Source
Thrown at autogpt_platform/backend/backend/api/features/oauth.py:739
)
# Check file size
if len(file_bytes) > LOGO_MAX_FILE_SIZE:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=(
"File too large. "
f"Maximum size is {LOGO_MAX_FILE_SIZE // 1024 // 1024}MB"
),
)
# Validate image dimensions
try:
image = Image.open(io.BytesIO(file_bytes))
width, height = image.size
if width != height:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Logo must be square. Got {width}x{height}",
)
if width < LOGO_MIN_SIZE:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Logo too small. Minimum {LOGO_MIN_SIZE}x{LOGO_MIN_SIZE}. "
f"Got {width}x{height}",
)
if width > LOGO_MAX_SIZE:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. "
f"Got {width}x{height}",
)
except HTTPException:View on GitHub (pinned to 9c8bb5550f)
Solutions
- Crop or pad the image to a square canvas (e.g. 1024x1024) before uploading
- Center the mark on a transparent square background for non-square logos
- Automate squaring in your asset pipeline
Example fix
# python
from PIL import Image
img = Image.open("logo.png")
# after: pad to square
side = max(img.size)
sq = Image.new("RGBA", (side, side), (0, 0, 0, 0))
sq.paste(img, ((side - img.width) // 2, (side - img.height) // 2))
sq.save("logo-square.png") Defensive patterns
Strategy: validation
Validate before calling
from PIL import Image
w, h = Image.open(path).size
if w != h:
raise ValueError(f"pad/crop to square first, got {w}x{h}") Type guard
def is_square(path: str) -> bool:
w, h = Image.open(path).size
return w == h Try / catch
if resp.status_code == 400 and "must be square" in resp.text:
pad_to_square_and_retry() Prevention
- Enforce square canvases in design templates
- Center-pad non-square marks on transparent squares
- Validate dimensions in the upload form before submit
When it happens
Trigger: Uploading a 1024x768 rectangle, a rounded logo on a non-square canvas, or an image with uneven padding.
Common situations: Marketing assets produced in 16:9 or 4:3; screenshots cropped loosely around a mark; batch exports that preserve source aspect ratio.
Related errors
- Logo too small. Minimum {LOGO_MIN_SIZE}x{LOGO_MIN_SIZE}. Got
- Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. Got
- Invalid file type. Allowed: JPEG, PNG, WebP. Got: {content_t
- File too large. Maximum size is {LOGO_MAX_FILE_SIZE // 1024
- Invalid image file
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/129cd8db1b1b0758.
Report an issue: GitHub.