[BUG] API Error 400 invalid_union / invalid_type on v2.1.69 (regression from v2.1.63)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After Claude Code auto-upgraded to v2.1.69, API calls fail with 400 Invalid Anthropic Messages API request. Downgrading to v2.1.63 resolves the issue entirely.
What Should Happen?
The error indicates type mismatches (expected string, received array).
Error Messages/Logs
API Error: 400 {
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid Anthropic Messages API request"
},
"request_id": null,
"metadata": {
"raw": "[
{
\"code\": \"invalid_union\",
\"errors\": [
{
\"expected\": \"string\",
\"code\": \"invalid_type\",
\"path\": [],
\"message\": \"Invalid input: expected string, received array\"
}
]
},
{
\"code\": \"invalid_union\",
\"errors\": [
{
\"code\": \"invalid_type\",
\"expected\": \"string\",
\"path\": [],
\"message\": \"Invalid input: expected string, received array\"
}
]
},
{
\"code\": \"invalid_value\",
...
}
]"
}
}
Steps to Reproduce
Let Claude Code auto-upgrade to v2.1.69 (or install it manually)
Use Claude Code normally (the error appears during regular API calls)
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.69
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Cursor
Additional Information
One solution
Downgrade to v2.1.63:
bashnpm install -g @anthropic-ai/claude-code@2.1.63
Verify:
bash which claude
# Expected: /root/.nvm/versions/node/v20.20.0/bin/claude (or your nvm path)
claude --version
# Expected: 2.1.63 (Claude Code)
Root Cause Hypothesis
It appears that v2.1.69 is constructing the messages request body incorrectly — passing an array where the API expects a string in the message content field. This could be a serialization change introduced between v2.1.63 and v2.1.69.
Environment
Broken version: Claude Code v2.1.69
Working version: Claude Code v2.1.63
Node: v20.20.0 (via nvm)
OS: Linux
Trigger: Auto-upgrade
summary
This issue was triggered by auto-upgrade. Consider adding a version pinning mechanism or a rollback command (e.g., claude --rollback) to help users recover quickly when a new release introduces regressions.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗