mudler / mudler/LocalAGI

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

Open
#340 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2k
Forks
291
Avg merge
30m
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the /v1/responses endpoint and reproduce the supplied payload with the input array and image content. Determine whether input or messages is the supported schema, then verify that malformed requests receive a descriptive 400 response rather than the current 500; clarify the multimodal format in the documentation if needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.