Skip to content

OpenCode 1.18.18 fails with session.messages() 400 when using json_schema output format #31

Description

@Zachary19980701

Description

When using the VS Code OpenCode extension with OpenCode TUI/server 1.18.18, sending a message fails with the following error:

Failed to send message: OpenCode SDK session.messages() returned no message array (status 400):
{"name":"BadRequest","data":{"message":"Expected OutputFormatJsonSchema, got {"type":"json_schema","schema":{...}}","kind":"Body"}}

The extension appears to send a structured output format similar to:

{
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"message",
"implementation_plan"
]
},
"text": {
"type": "string"
},
"plan": {
"type": "object"
}
}
}
}

The request then fails when the extension calls session.messages().

Environment
VS Code OpenCode extension: vscode-opencode
Repository: chryzxc/vscode-opencode
OpenCode TUI/server: 1.18.18
OpenCode installation method: npm
OpenCode executable:
/usr/bin/opencode
OS: Ubuntu / Linux
Node.js and npm installed system-wide

OpenCode itself is working from the terminal:

opencode --version

Output:

1.18.18
Error

Full relevant error:

Failed to send message: OpenCode SDK session.messages() returned no message array (status 400):
{"name":"BadRequest","data":{"message":"Expected OutputFormatJsonSchema, got {"type":"json_schema","schema":{"type":"object","properties":{"type":{"type":"string","enum":["message","implementation_plan"],"description":"Response type. MUST be 'implementation_plan' when the user requests a plan..."}}}}","kind":"Body"}}

The Runtime panel also previously showed:

OpenCode TUI 1.18.18
OpenCode SDK -
SDK and TUI versions are incompatible.
Update OpenCode TUI/server.
Expected behavior

The extension should successfully send the prompt and retrieve the response through the OpenCode SDK.

Structured output using:

{
"type": "json_schema",
"schema": {}
}

should either:

be accepted by the OpenCode server version declared compatible by the extension, or
be converted to the output format expected by the installed OpenCode SDK/server.
Actual behavior

The prompt/session workflow fails with HTTP 400 when the extension calls:

session.messages()

The server reports:

Expected OutputFormatJsonSchema

even though the stored/requested value appears to already contain:

{
"type": "json_schema",
"schema": {}
}
Compatibility concern

The extension currently declares support for OpenCode >=1.18.0 <1.19.0, while the packaged/tested SDK/server versions appear to be older 1.18.x versions.

OpenCode 1.18.18 is therefore inside the declared compatibility range, but currently fails with the structured-output/session message path.

Output:

1.18.18
Install/open the vscode-opencode extension.
Start a new OpenCode session.
Send a normal message.
The extension fails with:
OpenCode SDK session.messages() returned no message array (status 400)

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