Skip to content

GET /session/:id/message returns 400 when messages contain format with inline JSON schema #26929

@dhshah13

Description

@dhshah13

Description

What happened?

When sending a message via POST /session/:id/prompt_async with a format field:

{
  "format": {
    "type": "json_schema",
    "schema": {
      "type": "object",
      "properties": {
        "status": { "type": "string", "enum": ["created", "needs_info"] },
        "summary": { "type": "string" }
      },
      "required": ["status", "summary"]
    },
    "retryCount": 2
  }
}

The prompt is accepted (204), the LLM runs and completes successfully. But when calling GET /session/:id/message to retrieve messages, the server returns 400:

{"name":"BadRequest","data":{"message":"Expected OutputFormatJsonSchema, got {\"type\":\"json_schema\",\"schema\":{...}}"}}

The format field matches the OutputFormatJsonSchema definition in the OpenAPI spec at GET /doc exactly (type, schema, retryCount with additionalProperties: false). The message listing endpoint's deserialization rejects what the prompt endpoint accepted.

This appears to be a regression in the May 10-11 2026 releases that tightened HTTP API validation. The same workflow worked on versions before May 10.

Plugins

None (using opencode serve as HTTP API server with MCP servers configured via opencode.json)

OpenCode version

1.14.48

Steps to reproduce

Steps to reproduce:

  1. Start opencode serve --port 4096
  2. Create a session: POST /session with {"title": "test"}
  3. Send a prompt with format: POST /session/:id/prompt_async with body containing "format": {"type": "json_schema", "schema": {"type": "object", "properties": {"name": {"type": "string"}}, "required": ["name"]}, "retryCount": 2}
  4. Wait for the LLM to complete (poll GET /session/status until not busy)
  5. List messages: GET /session/:id/message
  6. Observe 400 Bad Request with "Expected OutputFormatJsonSchema" error

Screenshot and/or share link

No response

Operating System

Linux (OpenShift container), also reproducible on macOS 25.4.0

Terminal

N/A (HTTP API usage via Python httpx client)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions