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

Open
opened 2026-02-16 17:42:48 -05:00 by yindo · 1 comment
Owner

Originally created by @TechDufus on GitHub (Jan 3, 2026).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @TechDufus on GitHub (Jan 3, 2026). Originally assigned to: @rekram1-node on GitHub. ## Summary Setting `thinking.type` without `budgetTokens` causes `AI_InvalidArgumentError: invalid anthropic provider options` when using plan mode or compact. ## Reproduction Config (`opencode.json`): ```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: ```json { "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
Author
Owner

@github-actions[bot] commented on GitHub (Jan 3, 2026):

This issue might be a duplicate of or related to existing issues. Please check:

  • #2949: OUTPUT_TOKEN_MAX hardcoded to 32k prevents using full 64k output limit for Claude Sonnet 4.5 with extended thinking (similar thinking configuration limitation)

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Jan 3, 2026): This issue might be a duplicate of or related to existing issues. Please check: - #2949: OUTPUT_TOKEN_MAX hardcoded to 32k prevents using full 64k output limit for Claude Sonnet 4.5 with extended thinking (similar thinking configuration limitation) Feel free to ignore if this doesn't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4147