Significant-Gravitas/AutoGPT · error · HTTPException

Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. Got

Error message

Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. Got {width}x{height}

What it means

Returned (400) when the square image exceeds LOGO_MAX_SIZE (2048px). The API caps resolution to bound processing and storage cost.

Source

Thrown at autogpt_platform/backend/backend/api/features/oauth.py:752

    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:
        raise
    except Exception as e:
        logger.error(f"Error validating logo image: {e}")
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="Invalid image file",
        )

    # Scan for viruses
    filename = file.filename or "logo"
    await scan_content_safe(file_bytes, filename=filename)

    # Generate unique filename

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Resize to 2048x2048 or smaller (1024x1024 is usually plenty for web logos)
  2. Re-export from the design tool at web resolution

Example fix

# python
img = Image.open("logo.png")
# after
img = img.resize((2048, 2048), Image.LANCZOS)
img.save("logo-web.png", optimize=True)
Defensive patterns

Strategy: validation

Validate before calling

MAX = 2048
if max(Image.open(path).size) > MAX:
    img = Image.open(path).resize((MAX, MAX), Image.LANCZOS)
    img.save(path)

Type guard

def within_max_size(path: str, maximum: int = 2048) -> bool:
    return max(Image.open(path).size) <= maximum

Try / catch

if resp.status_code == 400 and "too large" in resp.text and "Maximum" in resp.text:
        resize_and_retry()

Prevention

When it happens

Trigger: Uploading a 4000x4000 print-quality or raw-camera-derived square image.

Common situations: Using print/master brand files directly; camera photos cropped square; scans at high DPI.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/1ab274ca7e915ca2. Report an issue: GitHub.