opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Partial thinking config doesn't merge with defaults, causing AI_InvalidArgumentError

Open TechDufus opened this issue 2 weeks ago • 1 comments

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

TechDufus avatar Jan 04 '26 04:01 TechDufus