Skip to content

[Bug] kontext model fails with "image is required" error despite image being provided #10134

Description

@pollinations-ai

Bug Summary

The kontext image model returns a 422 error claiming "image is required for image edits request" even when the image parameter is correctly provided in the request. The same request works fine with the klein model.

Environment

  • Endpoint: POST https://gen.pollinations.ai/v1/images/generations
  • Model: kontext
  • User: ajphoto (Discord)

Request

curl 'https://gen.pollinations.ai/v1/images/generations' \
  -H 'authorization: Bearer sk_key' \
  -H 'content-type: application/json' \
  --data-raw '{
    "model":"kontext",
    "prompt":"change her outfit to crop top with same color ",
    "image":"https://i.pinimg.com/474x/60/c5/c5/60c5c553c559628d07e5abb6b8d34d17.jpg",
    "size":"1152x1536",
    "response_format":"b64_json"
  }'

Error Response

{
  "success": false,
  "error": {
    "message": "{\"error\":\"Internal Server Error\",\"message\":\"{\\\"error\\\":{\\\"code\\\":\\\"Invalid input\\\",\\\"status\\\":422,\\\"message\\\":\\\"invalid input error\\\",\\\"details\\\":[{\\\"type\\\":\\\"Invalid Input\\\",\\\"msg\\\":\\\"image is required for image edits request.\\\"}]}}\\nPlease check this guide to understand why this error code ...\n",
    "code": "UNPROCESSABLE_ENTITY",
    "timestamp": "2026-04-11T14:21:41.935Z"
  }
}

Request Parameters (from response)

The backend correctly parsed the request and shows image was received:

{
  "prompt": "change her outfit to crop top with same color ",
  "width": 1152,
  "height": 1536,
  "model": "kontext",
  "image": ["https://i.pinimg.com/474x/60/c5/c5/60c5c553c559628d07e5abb6b8d34d17.jpg"]
}

Expected Behavior

The kontext model should accept the image URL and perform the image-to-image generation (outfit change) just like it does for other models like klein.

Actual Behavior

Returns 422 "image is required for image edits request" despite the image being present.

Comparison

  • kontext: Fails with 422 error
  • klein: Works correctly with same request

Additional Context

The error message appears to be coming from an underlying service (possibly Azure/Cloudflare based on the error format). The parameters show the image was received by the backend, so the issue appears to be in how the image is being passed to the upstream kontext model endpoint, or a validation mismatch.


Reported by: ajphoto via Discord
Source: Discord message


Author: ajphoto (UID: 1109503043004801094)
Source: View on Discord

Metadata

Metadata

Assignees

No one assigned

    Labels

    .BUGSomething brokenAPIAPI/SDK generalIMAGEImage generation

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions