anomalyco / anomalyco/opencode
question tool: model omits required "header" on later multi-question entries, producing SchemaError
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Same root cause as #45524 (insufficient per-entry guidance for repeated questions[] items), but for header instead of question.
When the question tool is called with multiple entries in questions[], the model occasionally omits the required header field on the second or later entries. The schema correctly rejects the call with SchemaError(Missing key at ["questions"][1]["header"]), and a retry usually succeeds, but the failure recurs because later entries are structurally abbreviated and the model-facing tool description never stated that every entry needs its own header.
Impact
- Every occurrence is recorded as an error span in OTel tracing and inflates the
opencode.tool.questionerror rate. - The question is never surfaced to the user; the interaction is silently lost until a retry succeeds.
Why strict validation should stay: header is meaningful UI data (it labels each question in the prompt), so it cannot be reconstructed deterministically from the question text.
Plugins
No response
OpenCode version
Version 1.18.23
Model: amazon-bedrock/eu.anthropic.claude-sonnet-4-6
Steps to reproduce
Call the question tool with two questions where the second entry omits header:
{
"questions": [
{
"header": "Database",
"question": "Which database should we use for the new service?",
"options": [
{ "label": "PostgreSQL", "description": "Relational, ACID-compliant." },
{ "label": "MongoDB", "description": "Document store, flexible schema." }
]
},
{
"question": "Which caching strategy should we use?",
"options": [
{ "label": "Redis", "description": "In-memory, fast." },
{ "label": "None", "description": "Query the database directly." }
]
}
]
}
The call fails with SchemaError(Missing key at ["questions"][1]["header"]). A manually constructed call with header present on both entries succeeds; the bug is generative and the schema validator catches it correctly.
Screenshot and/or share link
No response
Operating System
MacOS 26.6.2
Terminal
Warp
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the TypeScript codebase for the question tool, its questions[] schema, and the model-facing description; begin with the header definition and the guidance for repeated entries. Reproduce the two-entry payload, then verify that each entry is described as requiring its own header and that the call no longer fails with the reported SchemaError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100