Skip to content

500 Internal Server Error — “no messages in fragment” when using /v1/responses endpoint Image Input #340

@MeetSolanki530

Description

@MeetSolanki530

When sending a POST request to the /v1/responses endpoint with the parameter input, the API returns a 500 error with the message:

{"error":"no messages in fragment"}

500
{"id":"","object":"","created_at":0,"status":"","error":"no messages in fragment","incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"","output":null,"parallel_tool_calls":false,"previous_response_id":null,"reasoning":{},"store":false,"temperature":0,"text":{},"tool_choice":"","tools":null,"top_p":0,"truncation":"","usage":{"input_tokens":0,"input_tokens_details":{"cached_tokens":0},"output_tokens":0,"output_tokens_details":{"cached_tokens":0},"total_tokens":0},"user":null,"metadata":null}

Steps to Reproduce

  1. Send a request similar to the following:
import requests, json

url = "http://localhost:8080/v1/responses"
headers = {"Content-Type": "application/json"}
data = {
    "model": "LocalAI_Agent",
    "input": [
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "what is in this image?"},
                {
                    "type": "input_image",
                    "image_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMsAAAD4CAMAAAB1y+ICAAAB6VBMVEAFADpnqTrj4znsqTZb3kfTWF7CCC3CiuAAAkAFRY9PUcAVmIAJS1/ZA2xkQVENwLPrg1gUwqzmgpeBh6YABmZfgtHMwhmVwWdfgN7cAl3aCr73QEeVnLtUXp5oprleXrnuVZDCZTINtydpLvb0tidZfG9H28RZi7FeL5H/otPT/AdHKBBs1r1ZSAAAAAElFTkSuQmCC..."
                }
            ]
        }
    ]
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.status_code, response.text)

Expected Behavior

Should return a valid model response analyzing the text and image input.

Actual Behavior

Returns:

500 Internal Server Error
{"error":"no messages in fragment"}

Possible Cause

The /v1/responses endpoint appears to require a messages array instead of an input array, following the newer message-based schema. When using input, the request payload does not match the expected structure, causing the backend to throw an internal error instead of returning a user-facing validation message.

Suggested Fix

  • Validate incoming requests for expected fields (messages vs input) and return a 400 Bad Request with a descriptive message rather than 500.
  • Update documentation to clarify the correct parameter format for multimodal input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions