opencode
opencode copied to clipboard
Partial thinking config doesn't merge with defaults, causing AI_InvalidArgumentError
Summary
Setting thinking.type without budgetTokens causes AI_InvalidArgumentError: invalid anthropic provider options when using plan mode or compact.
Reproduction
Config (opencode.json):
{
"provider": {
"anthropic": {
"models": {
"claude-opus-4-5": {
"options": {
"thinking": {
"type": "hidden"
}
}
}
}
}
}
}
Then use plan mode or compact.
Expected
Partial config merges with defaults. User just wants to hide thinking blocks - budgetTokens should use OpenCode's default.
Actual
The incomplete thinking object is passed to the AI SDK as-is:
{
"thinking": {
"type": "hidden",
"budgetTokens": null
}
}
SDK validation fails because budgetTokens must be a number.
Workaround
Add budgetTokens manually or remove the thinking config entirely.
Version
1.0.223