{"record":{"id":"127236c7aaa03807","repo":"odysseus-dev/odysseus","slug":"pillow-not-installed-on-server","errorCode":null,"errorMessage":"Pillow not installed on server","messagePattern":"Pillow not installed on server","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/gallery/gallery_routes.py","lineNumber":1321,"sourceCode":"\n        if not base.endswith(\"/v1\"):\n            base += \"/v1\"\n\n        is_openai = _is_openai_api_base(base)\n\n        if is_openai:\n            # OpenAI path: /v1/images/edits with gpt-image-1.\n            # Mask convention differs from Stable Diffusion:\n            #   SD:     white pixels = regenerate, black = keep\n            #   OpenAI: transparent alpha = regenerate, opaque = keep\n            # So we convert the incoming PNG mask into an alpha-channel PNG.\n            if not api_key:\n                raise HTTPException(400, \"OpenAI endpoint has no api_key stored — edit it in Endpoints settings.\")\n            import base64, io\n            try:\n                from PIL import Image\n            except ImportError:\n                raise HTTPException(500, \"Pillow not installed on server\")\n\n            try:\n                img_bytes = base64.b64decode(body[\"image\"])\n                mask_bytes = base64.b64decode(body[\"mask\"])\n                source_png = Image.open(io.BytesIO(img_bytes)).convert(\"RGBA\")\n                mask_png = Image.open(io.BytesIO(mask_bytes)).convert(\"L\")  # luminance\n                # Build OpenAI mask: RGBA where alpha=255 means keep, 0 means regenerate.\n                # SD mask: white (255) = regenerate → alpha 0.  Black (0) = keep → alpha 255.\n                # RGB must be white for keep areas; start from fully-white opaque and\n                # overwrite alpha so visual contents match the expected semantic.\n                alpha = mask_png.point(lambda p: 255 - p)\n                oa_mask = Image.new(\"RGBA\", source_png.size, (255, 255, 255, 255))\n                oa_mask.putalpha(alpha)\n\n                src_buf = io.BytesIO()\n                source_png.save(src_buf, format=\"PNG\")\n                src_buf.seek(0)\n                mask_buf = io.BytesIO()","sourceCodeStart":1303,"sourceCodeEnd":1339,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/gallery/gallery_routes.py#L1303-L1339","documentation":"Error \"Pillow not installed on server\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Install Pillow into the server Python environment: pip install Pillow.","Install the image dependencies from the project requirements and restart."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}