Significant-Gravitas/AutoGPT · error · HTTPException
File too large. Maximum size is {LOGO_MAX_FILE_SIZE // 1024
Error message
File too large. Maximum size is {LOGO_MAX_FILE_SIZE // 1024 // 1024}MB What it means
Returned (400) when the uploaded logo's byte size exceeds LOGO_MAX_FILE_SIZE (3MB, derived from the message computed as LOGO_MAX_FILE_SIZE // 1024 // 1024). The check happens after reading the whole body, so oversized files are fully transferred before rejection.
Source
Thrown at autogpt_platform/backend/backend/api/features/oauth.py:725
if content_type not in LOGO_ALLOWED_TYPES:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Invalid file type. Allowed: JPEG, PNG, WebP. Got: {content_type}",
)
# Read file content
try:
file_bytes = await file.read()
except Exception as e:
logger.error(f"Error reading logo file: {e}")
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Failed to read uploaded file",
)
# 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}",
)
View on GitHub (pinned to 9c8bb5550f)
Solutions
- Compress or resize the image to get under 3MB (target 512-2048px square, which easily fits)
- Convert to WebP for better compression
- Strip metadata/EXIF before uploading
Example fix
# python - before: raw export
img.save("logo.png") # 8MB
# after
img = img.resize((1024, 1024)); img.save("logo.webp", quality=85) # <200KB Defensive patterns
Strategy: validation
Validate before calling
MAX_BYTES = 3 * 1024 * 1024
if os.path.getsize(path) > MAX_BYTES:
raise ValueError("compress logo to under 3MB") Try / catch
if resp.status_code == 400 and "File too large" in resp.text:
recompress_and_retry() Prevention
- Check file size client-side before the POST
- Standardize on WebP exports for logos
- Automate downscaling in the asset pipeline
When it happens
Trigger: Uploading a logo larger than 3MB, e.g. an unoptimized 4000x4000 PNG exported from design tooling.
Common situations: High-resolution exports from Figma/Photoshop; photos with EXIF used as logos; WebP/PNG with no compression applied.
Related errors
- Invalid file type. Allowed: JPEG, PNG, WebP. Got: {content_t
- Logo must be square. Got {width}x{height}
- Logo too small. Minimum {LOGO_MIN_SIZE}x{LOGO_MIN_SIZE}. Got
- Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. Got
- Expiration hours must be between 1 and 48
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/e9507fd1e4ceeeb4.
Report an issue: GitHub.