Skip to content

JSON Schema validation fails on empty tool parameters {} with Kimi K2.5 (strict mode error) #11357

Closed

Description

@Seniortuco

Description

Environment

  • OpenCode version: 1.1.46
  • Provider / Model: Kimi K2.5 (free via Fireworks or Moonshot endpoint)
  • OS: macOS
  • Date: January 30, 2026

Bug Description

When Kimi K2.5 attempts to call a tool with empty object parameters ({}), it returns a JSON Schema validation error:

JSON Schema not supported: could not understand the instance `{}`.

Or a similar variant:

could not validate instance {} against schema ...

This occurs consistently on certain OpenCode internal tools that define parameters: z.object({}) (typically those without required arguments, such as certain read/state helper tools).

Steps to Reproduce

  1. Update OpenCode to the latest version (opencode update or reinstall)
  2. Configure Kimi K2.5 as the main model (free for now)
  3. Start a session and request a task that triggers multiple tool calls in sequence
  4. Often after 2-5 exchanges → the error appears when the model wants to call a tool without parameters

Expected Behavior

OpenCode should be able to handle tool schemas with an empty object without causing validation failures on the provider side. Kimi K2.5 appears to have stricter JSON Schema validation than Claude / GPT-4o / Gemini on this specific case (likely requires explicit "required": [] even for an object without properties).

Current Workaround

Temporarily switch to another model (Claude 4, GPT-4o-mini, Gemini 2.0 flash, GLM-4.7…) → the bug disappears.

Or downgrade to Kimi Code / an earlier version if available.

Related Issues

Additional Context

Kimi K2.5 is excellent in terms of performance/price ratio right now. This small bug is the only real blocker for using it extensively in OpenCode. The issue seems to be related to how Kimi handles JSON Schema validation for minimal/empty objects - it may require explicit schema completion even when no properties are present.

Plugins

No response

OpenCode version

1.1.46

Steps to reproduce

  1. Update OpenCode to version 1.1.46 (or latest)
  2. Configure Kimi K2.5 as the main model (free via Fireworks or Moonshot endpoint)
  3. Start an OpenCode session with a complex task that requires multiple tool calls
  4. Request tasks that trigger sequential tool calls (e.g., code analysis with multiple helper tools)
  5. Within 2-5 exchanges, the model will attempt to call a tool with empty parameters ({})
  6. JSON Schema validation error appears

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. rekram1-node commented on Jan 30, 2026

    @rekram1-node
    Contributor

    Can you send me an example? opencode export > session.json

  2. self-assigned this
    on Jan 30, 2026
  3. R44VC0RP commented on Jan 30, 2026

    @R44VC0RP
    Contributor

    I am unable to repro this on 1.1.46 with Kimi K2.5 Fireworks or Kimi K2.5 via Zen

  4. moddi3 commented on Jan 31, 2026

    @moddi3

    @rekram1-node i have the issue with opencode 1.47 and kimi-k2.5-free on zen, here is sesstion export

    session.json

  5. drevantonder commented on Feb 1, 2026

    @drevantonder
    Contributor

    Similar and/or related. I get

    JSON Schema not supported: could not understand the instance `{'not': {}}`.
    

    session json:

    {
      "info": {
        "id": "ses_3e775b654ffepnRjPmQPuWU9n1",
        "slug": "tidy-canyon",
        "version": "1.1.48",
        "projectID": "44fae5a933cfba39852e86b08f84d825ce4b9515",
        "directory": "/Users/drevan/projects/personal",
        "title": "Light chat greeting",
        "time": {
          "created": 1769938241963,
          "updated": 1769938247170
        },
        "summary": {
          "additions": 0,
          "deletions": 0,
          "files": 0
        }
      },
      "messages": [
        {
          "info": {
            "id": "msg_c188a49ae001yZjr6PtM7MO06K",
            "sessionID": "ses_3e775b654ffepnRjPmQPuWU9n1",
            "role": "user",
            "time": {
              "created": 1769938241973
            },
            "summary": {
              "title": "Greeting tone check-in",
              "diffs": []
            },
            "agent": "build",
            "model": {
              "providerID": "opencode",
              "modelID": "kimi-k2.5-free"
            }
          },
          "parts": [
            {
              "id": "prt_c188a49ae002jQK8pDvgT0KOQn",
              "sessionID": "ses_3e775b654ffepnRjPmQPuWU9n1",
              "messageID": "msg_c188a49ae001yZjr6PtM7MO06K",
              "type": "text",
              "text": "hey!"
            }
          ]
        },
        {
          "info": {
            "id": "msg_c188a49be001v5GnC5o3ER55y4",
            "sessionID": "ses_3e775b654ffepnRjPmQPuWU9n1",
            "role": "assistant",
            "time": {
              "created": 1769938241982,
              "completed": 1769938249755
            },
            "error": {
              "name": "APIError",
              "data": {
                "message": "JSON Schema not supported: could not understand the instance `{'not': {}}`.",
                "statusCode": 400,
                "isRetryable": false,
                "responseHeaders": {
                  "cf-placement": "remote-ATL",
                  "cf-ray": "9c706ea6ac4c2f4b-LAX",
                  "connection": "keep-alive",
                  "content-type": "application/json",
                  "date": "Sun, 01 Feb 2026 09:30:49 GMT",
                  "server": "cloudflare",
                  "transfer-encoding": "chunked",
                  "vary": "accept-encoding"
                },
                "responseBody": "{\"error\":{\"object\":\"error\",\"type\":\"invalid_request_error\",\"code\":\"invalid_request_error\",\"message\":\"JSON Schema not supported: could not understand the instance `{'not': {}}`.\"}}",
                "metadata": {
                  "url": "https://opencode.ai/zen/v1/chat/completions"
                }
              }
            },
            "parentID": "msg_c188a49ae001yZjr6PtM7MO06K",
            "modelID": "kimi-k2.5-free",
            "providerID": "opencode",
            "mode": "build",
            "agent": "build",
            "path": {
              "cwd": "/Users/drevan/projects/personal",
              "root": "/Users/drevan/projects/personal"
            },
            "cost": 0,
            "tokens": {
              "input": 0,
              "output": 0,
              "reasoning": 0,
              "cache": {
                "read": 0,
                "write": 0
              }
            }
          },
          "parts": []
        }
      ]
    }

    If I disable all the MCP servers in my project's opencode.json, it works. My opencode.json in the project:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "cloudflare-bindings": {
          "type": "remote",
          "enabled": true,
    			"url": "https://bindings.mcp.cloudflare.com/mcp"
    		},
        "cloudflare-docs": {
          "type": "remote",
          "enabled": true,
    			"url": "https://docs.mcp.cloudflare.com/mcp"
    		},
        "cloudflare-worker-observability": {
          "type": "remote",
          "enabled": true,
    			"url": "https://observability.mcp.cloudflare.com/mcp"
    		},
        "cloudflare-worker-builds": {
          "type": "remote",
          "enabled": true,
    			"url": "https://builds.mcp.cloudflare.com/mcp"
        }
      }
    }

    Or if I run it outside the project, it works as well.

  6. tomjod commented on Feb 2, 2026

    @tomjod

    same problem here but If I disable all the MCP servers in my project's opencode.json, it works.

  7. drevantonder commented on Feb 3, 2026

    @drevantonder
    Contributor

    Strangely, if I disable all the MCP tools via glob pattern and renable manually for each one (minus one specific tool for mcp-google-sheets) it now works. E.g.

    {
    "tools": {
        "mcp-google-sheets*": false,
        "cloudflare-bindings*": false,
        "cloudflare_bindings_accounts_list": true,
        "cloudflare_bindings_set_active_account": true,
        "cloudflare_bindings_kv_namespaces_list": true,
        "cloudflare_bindings_kv_namespace_create": true,
        "cloudflare_bindings_kv_namespace_delete": true,
        "cloudflare_bindings_kv_namespace_get": true,
        "cloudflare_bindings_kv_namespace_update": true,
        "cloudflare_bindings_workers_list": true,
        "cloudflare_bindings_workers_get_worker": true,
        "cloudflare_bindings_workers_get_worker_code": true,
        "cloudflare_bindings_r2_buckets_list": true,
        "cloudflare_bindings_r2_bucket_create": true,
        "cloudflare_bindings_r2_bucket_get": true,
        "cloudflare_bindings_r2_bucket_delete": true,
        "cloudflare_bindings_d1_databases_list": true,
        "cloudflare_bindings_d1_database_create": true,
        "cloudflare_bindings_d1_database_delete": true,
        "cloudflare_bindings_d1_database_get": true,
        "cloudflare_bindings_d1_database_query": true,
        "cloudflare_bindings_hyperdrive_configs_list": true,
        "cloudflare_bindings_hyperdrive_config_create": true,
        "cloudflare_bindings_hyperdrive_config_delete": true,
        "cloudflare_bindings_hyperdrive_config_get": true,
        "cloudflare_bindings_hyperdrive_config_edit": true,
        "mcp-google-sheets_add_columns": true,
        "mcp-google-sheets_add_rows": true,
        "mcp-google-sheets_batch_update": true,
        "mcp-google-sheets_batch_update_cells": true,
        "mcp-google-sheets_copy_sheet": true,
        "mcp-google-sheets_create_sheet": true,
        "mcp-google-sheets_create_spreadsheet": true,
        "mcp-google-sheets_find_in_spreadsheet": true,
        "mcp-google-sheets_get_multiple_sheet_data": true,
        "mcp-google-sheets_get_multiple_spreadsheet_summary": true,
        "mcp-google-sheets_get_sheet_data": true,
        "mcp-google-sheets_get_sheet_formulas": true,
        "mcp-google-sheets_list_folders": true,
        "mcp-google-sheets_list_sheets": true,
        "mcp-google-sheets_list_spreadsheets": true,
        "mcp-google-sheets_rename_sheet": true,
        "mcp-google-sheets_search_spreadsheets": true,
        "mcp-google-sheets_share_spreadsheet": true,
        // "mcp-google-sheets_update_cells": true
      }
    }

    And more details on what/which error:
    mcp-google-sheets enabled gives:

    JSON Schema not supported: could not understand the instance `{}`.
    

    cloudflare-bindings enabled gives:

    JSON Schema not supported: could not understand the instance `{'not': {}}`.
    

    (The rest of the MCPs don't throw an error)

  8. rekram1-node commented on Feb 3, 2026

    @rekram1-node
    Contributor

    Ahh okay that helps, ill look

  9. chandler2252 commented on Feb 6, 2026

    @chandler2252

    Unrelated to opencode, but I am seeing the same exact situation with Flowise 3.0.12 self hosted. Same model on Fireworks. Same response. I've tried it with many different MCP servers and tools. Unsure what is causing it currently.

    For what it's worth.

  10. github-actions commented on Apr 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions