{"record":{"id":"e9507fd1e4ceeeb4","repo":"Significant-Gravitas/AutoGPT","slug":"file-too-large-maximum-size-is-logo-max-file-siz","errorCode":null,"errorMessage":"File too large. Maximum size is {LOGO_MAX_FILE_SIZE // 1024 // 1024}MB","messagePattern":"File too large\\. Maximum size is (.+?)MB","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/oauth.py","lineNumber":725,"sourceCode":"    if content_type not in LOGO_ALLOWED_TYPES:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=f\"Invalid file type. Allowed: JPEG, PNG, WebP. Got: {content_type}\",\n        )\n\n    # Read file content\n    try:\n        file_bytes = await file.read()\n    except Exception as e:\n        logger.error(f\"Error reading logo file: {e}\")\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Failed to read uploaded file\",\n        )\n\n    # Check file size\n    if len(file_bytes) > LOGO_MAX_FILE_SIZE:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=(\n                \"File too large. \"\n                f\"Maximum size is {LOGO_MAX_FILE_SIZE // 1024 // 1024}MB\"\n            ),\n        )\n\n    # Validate image dimensions\n    try:\n        image = Image.open(io.BytesIO(file_bytes))\n        width, height = image.size\n\n        if width != height:\n            raise HTTPException(\n                status_code=status.HTTP_400_BAD_REQUEST,\n                detail=f\"Logo must be square. Got {width}x{height}\",\n            )\n","sourceCodeStart":707,"sourceCodeEnd":743,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/oauth.py#L707-L743","documentation":"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.","triggerScenarios":"Uploading a logo larger than 3MB, e.g. an unoptimized 4000x4000 PNG exported from design tooling.","commonSituations":"High-resolution exports from Figma/Photoshop; photos with EXIF used as logos; WebP/PNG with no compression applied.","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"],"exampleFix":"# python - before: raw export\nimg.save(\"logo.png\")  # 8MB\n# after\nimg = img.resize((1024, 1024)); img.save(\"logo.webp\", quality=85)  # <200KB","handlingStrategy":"validation","validationCode":"MAX_BYTES = 3 * 1024 * 1024\nif os.path.getsize(path) > MAX_BYTES:\n    raise ValueError(\"compress logo to under 3MB\")","typeGuard":null,"tryCatchPattern":"if resp.status_code == 400 and \"File too large\" in resp.text:\n        recompress_and_retry()","preventionTips":["Check file size client-side before the POST","Standardize on WebP exports for logos","Automate downscaling in the asset pipeline"],"tags":["validation","http-400","file-upload"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}