{"record":{"id":"9c3c54dfdc07c762","repo":"odysseus-dev/odysseus","slug":"type-pipe-name-does-not-support-image-edit","errorCode":null,"errorMessage":"{type(_pipe).__name__} does not support image edits. Use /v1/images/generations with this model.","messagePattern":"(.+?) does not support image edits\\. Use /v1/images/generations with this model\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"scripts/diffusion_server.py","lineNumber":778,"sourceCode":"\n\n@app.post(\"/v1/images/edits\")\nasync def edit_image(\n    prompt: str = Form(...),\n    image: UploadFile = File(...),\n    model: str = Form(\"\"),\n    n: int = Form(1),\n    size: str = Form(\"1024x1024\"),\n    quality: str = Form(\"medium\"),\n    response_format: str = Form(\"b64_json\"),\n    request_id: str = Form(\"\"),\n):\n    if _pipe is None:\n        return {\"error\": \"Model not loaded\"}\n    accepts_image = _pipeline_accepts_arg(\"image\")\n    accepts_input_images = _pipeline_accepts_arg(\"input_images\")\n    if not accepts_image and not accepts_input_images:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"{type(_pipe).__name__} does not support image edits. Use /v1/images/generations with this model.\",\n        )\n\n    from PIL import Image as PILImage, ImageOps\n\n    width, height = _parse_size(size)\n    steps = _quality_steps(quality)\n    request_id = _start_progress(request_id, steps * max(1, min(int(n or 1), 4)), prompt, \"edit\")\n    raw = await image.read()\n    init_image = PILImage.open(io.BytesIO(raw)).convert(\"RGB\")\n    if width > 0 and height > 0:\n        init_image = ImageOps.fit(init_image, (width, height), method=PILImage.LANCZOS, centering=(0.5, 0.5))\n\n    logger.info(f\"Editing image: {prompt[:80]}... ({width}x{height}, {steps} steps)\")\n    start = time.time()\n    images = []\n    total_images = max(1, min(int(n or 1), 4))","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/scripts/diffusion_server.py#L760-L796","documentation":"Raised by the /v1/images/edits endpoint in scripts/diffusion_server.py when the currently loaded diffusers pipeline class does not accept an 'image' or 'input_images' argument (checked via _pipeline_accepts_arg). It means the served model is text-to-image only (e.g. a pure StableDiffusionPipeline) while the caller invoked the OpenAI-style edits endpoint, which requires an img2img/inpaint pipeline. The server refuses the call with HTTP 400 instead of letting the pipeline fail with a confusing TypeError.","triggerScenarios":"POST to /v1/images/edits with a multipart 'image' file while the loaded pipeline is a generation-only class (its __call__/forward signature has no 'image' or 'input_images' parameter). Typical after loading e.g. 'stable-diffusion-2-1' base rather than an '*-inpaint' or img2img-capable variant.","commonSituations":"Server was launched with a base text-to-image checkpoint; client (OpenAI SDK images.edit) is reused against a local endpoint; model was switched at runtime to a non-edit pipeline; typo in the model repo id resolving to the base variant.","solutions":["Switch the request to POST /v1/images/generations, which the loaded pipeline supports, passing the prompt only","Relaunch the server with an edit-capable model (e.g. an '-inpaint' or img2img variant repo id) so the pipeline accepts an image argument","Verify which pipeline class is loaded (type(_pipe).__name__ in the error) and pick a repo whose class supports edits","If you maintain the server, add a /v1/models capability field so clients can detect edit support before calling"],"exampleFix":"# before\nclient.images.edit(image=open('cat.png','rb'), prompt='add a hat')\n# after (generation-only pipeline)\nclient.images.generate(prompt='a cat wearing a hat')","handlingStrategy":"validation","validationCode":"# Probe edit support before calling edits\nimport requests\ncaps = requests.get(f\"{base}/v1/models\").json()\n# servers do not advertise caps; safest check: try generations, or inspect pipeline name via any diagnostics endpoint\nedit_capable = False  # assume not unless server documents it","typeGuard":"def supports_edits(pipeline) -> bool:\n    import inspect\n    params = inspect.signature(pipeline.__call__).parameters\n    return 'image' in params or 'input_images' in params","tryCatchPattern":"from fastapi import HTTPException\ntry:\n    resp = client.images.edit(image=f, prompt=p)\nexcept HTTPException as e:  # or openai.APIStatusError with 400\n    if 'does not support image edits' in str(e):\n        resp = client.images.generate(prompt=reconstructed_prompt)","preventionTips":["Check the loaded pipeline class before wiring an edits client","Document per-model capability in your service catalog","Default clients to /v1/images/generations for unknown models"],"tags":["diffusers","http-400","image-editing","fastapi"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}