{"record":{"id":"129cd8db1b1b0758","repo":"Significant-Gravitas/AutoGPT","slug":"logo-must-be-square-got-width-x-height","errorCode":null,"errorMessage":"Logo must be square. Got {width}x{height}","messagePattern":"Logo must be square\\. Got (.+?)x(.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/oauth.py","lineNumber":739,"sourceCode":"        )\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\n        if width < LOGO_MIN_SIZE:\n            raise HTTPException(\n                status_code=status.HTTP_400_BAD_REQUEST,\n                detail=f\"Logo too small. Minimum {LOGO_MIN_SIZE}x{LOGO_MIN_SIZE}. \"\n                f\"Got {width}x{height}\",\n            )\n\n        if width > LOGO_MAX_SIZE:\n            raise HTTPException(\n                status_code=status.HTTP_400_BAD_REQUEST,\n                detail=f\"Logo too large. Maximum {LOGO_MAX_SIZE}x{LOGO_MAX_SIZE}. \"\n                f\"Got {width}x{height}\",\n            )\n    except HTTPException:","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/oauth.py#L721-L757","documentation":"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.","triggerScenarios":"Uploading a 1024x768 rectangle, a rounded logo on a non-square canvas, or an image with uneven padding.","commonSituations":"Marketing assets produced in 16:9 or 4:3; screenshots cropped loosely around a mark; batch exports that preserve source aspect ratio.","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"],"exampleFix":"# python\nfrom PIL import Image\nimg = Image.open(\"logo.png\")\n# after: pad to square\nside = max(img.size)\nsq = Image.new(\"RGBA\", (side, side), (0, 0, 0, 0))\nsq.paste(img, ((side - img.width) // 2, (side - img.height) // 2))\nsq.save(\"logo-square.png\")","handlingStrategy":"validation","validationCode":"from PIL import Image\nw, h = Image.open(path).size\nif w != h:\n    raise ValueError(f\"pad/crop to square first, got {w}x{h}\")","typeGuard":"def is_square(path: str) -> bool:\n    w, h = Image.open(path).size\n    return w == h","tryCatchPattern":"if resp.status_code == 400 and \"must be square\" in resp.text:\n        pad_to_square_and_retry()","preventionTips":["Enforce square canvases in design templates","Center-pad non-square marks on transparent squares","Validate dimensions in the upload form before submit"],"tags":["validation","http-400","image","file-upload"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}