anomalyco / anomalyco/opencode

question tool: model omits required "question" field on multi-question calls, producing SchemaError

Open
#45,524 1 comment 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Summary

When the question tool is called with multiple items in the questions array,
the model (amazon-bedrock/eu.anthropic.claude-sonnet-4-6) occasionally omits
the required "question" field on one or more items. This causes a runtime
SchemaError and the span is recorded as an error in OTel tracing.

Error message

The question tool was called with invalid arguments: SchemaError(Missing key at ["questions"][1]["question"]). Please rewrite the input so it satisfies the expected schema.

Impact
Every occurrence is recorded as an error span (otelcol.signal: traces, status ERROR)
Inflates opencode.tool.question error rate in OTel/SigNoz dashboards
The question is never surfaced to the user; the interaction is silently lost
Environment
Model: amazon-bedrock/eu.anthropic.claude-sonnet-4-6
Observed via OTel tracing (SigNoz, collector otel/opentelemetry-collector-contrib:0.139.0)
Suggested fix
Add a retry-on-schema-error path that asks the model to correct and resubmit the malformed call
And/or strengthen the system prompt to remind the model that "question" is required on every array item

Plugins

No response

OpenCode version

Version 1.18.23 (1.18.23)

Steps to reproduce

Minimal reproduction

The following tool call input triggers the error — second item is missing "question":

{
  "questions": [
    {
      "header": "Database schema",
      "question": "Which database should we use for the new service?",
      "options": [
        { "label": "PostgreSQL", "description": "Relational, ACID-compliant, good for structured data." },
        { "label": "MongoDB", "description": "Document store, flexible schema, good for unstructured data." }
      ]
    },
    {
      "header": "Caching strategy",
      "options": [
        { "label": "Redis", "description": "In-memory, fast, good for session data." },
        { "label": "No cache", "description": "Keep it simple, query DB directly." }
      ]
    }
  ]
}

Verification
A manually constructed call with "question" present on both items succeeds with no error. The bug is generative — the model drops the field; the schema validator catches it correctly.


### Screenshot and/or share link

_No response_

### Operating System

MacOS 26.6.2

### Terminal

Warp

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.