odysseus-dev/odysseus · error · HTTPException
Failed to prepare inpaint request
Error message
Failed to prepare inpaint request
What it means
Error "Failed to prepare inpaint request" thrown in odysseus-dev/odysseus.
Source
Thrown at routes/gallery/gallery_routes.py:1346
# Build OpenAI mask: RGBA where alpha=255 means keep, 0 means regenerate.
# SD mask: white (255) = regenerate → alpha 0. Black (0) = keep → alpha 255.
# RGB must be white for keep areas; start from fully-white opaque and
# overwrite alpha so visual contents match the expected semantic.
alpha = mask_png.point(lambda p: 255 - p)
oa_mask = Image.new("RGBA", source_png.size, (255, 255, 255, 255))
oa_mask.putalpha(alpha)
src_buf = io.BytesIO()
source_png.save(src_buf, format="PNG")
src_buf.seek(0)
mask_buf = io.BytesIO()
oa_mask.save(mask_buf, format="PNG")
mask_buf.seek(0)
except HTTPException:
raise
except Exception:
logger.exception("inpaint_proxy: failed to prepare OpenAI request")
raise HTTPException(400, "Failed to prepare inpaint request")
width = int(body.get("width") or 1024)
height = int(body.get("height") or 1024)
# gpt-image-1 only accepts 1024x1024, 1024x1536, 1536x1024 (no 'auto'
# for edits). Pick the closest to preserve aspect, default square.
if width > height * 1.15:
size = "1536x1024"
elif height > width * 1.15:
size = "1024x1536"
else:
size = "1024x1024"
files = {
"image": ("source.png", src_buf.getvalue(), "image/png"),
"mask": ("mask.png", mask_buf.getvalue(), "image/png"),
}
# Honor explicit model selection from the editor; fall back to gpt-image-1.
# dall-e-3 has no edit endpoint — refuse it loudly so the user picks again.View on GitHub (pinned to f9235ebbf1)
Solutions
- Retry with a smaller image or mask; check server logs for details.
- Verify the image and mask decode correctly before sending.
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/22730c7eb92afa6c.
Report an issue: GitHub.