Invalid API Model Name Causing 400 Bad Request Error
Bug Description seeing 400 API error continously - API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 1.0.35
- Feedback ID: c9e58807-8565-497a-bf90-af3bf897da04
Errors
[{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n at eD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:1184)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:912\n at Array.map (<anonymous>)\n at mK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:903)\n at vR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:9268)\n at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-28T16:17:25.068Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n at eD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:1184)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:912\n at Array.map (<anonymous>)\n at mK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:903)\n at vR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:9268)\n at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-28T16:19:51.296Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: template\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1367:418\n at Object.useMemo (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:26276)\n at aH9.useMemo (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:46:15576)\n at KW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1367:312)\n at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)\n at oW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:34976)","timestamp":"2025-06-28T17:27:40.495Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n at eD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:1184)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:912\n at Array.map (<anonymous>)\n at mK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:903)\n at vR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:9268)\n at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-28T17:27:40.532Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n at eD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:1184)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:912\n at Array.map (<anonymous>)\n at mK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:903)\n at uR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:
Note: Error logs were truncated.
same issue.
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
Claude Code Status v1.0.38
L Session ID: 90a8c87b-25ea-442f-9482-cceb0948c554
Working Directory
L /Users/jojo/repository/realtime-log-web
Installation Health • /doctor
⚠ Config mismatch: running npm-global but config says unknown
Account • /login
L Login Method: Claude Max Account
L Organization: [email protected]'s Organization
L Email: [email protected]
API Configuration
L Proxy: xxx
Model • /model
L Default Opus 4 for up to 50% of usage limits, then use Sonnet 4 (currently Opus)
same issue.
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
Claude Code Status v1.0.38 L Session ID: 90a8c87b-25ea-442f-9482-cceb0948c554 Working Directory L /Users/jojo/repository/realtime-log-web Installation Health • /doctor ⚠ Config mismatch: running npm-global but config says unknown Account • /login L Login Method: Claude Max Account L Organization: [email protected]'s Organization L Email: [email protected] API Configuration L Proxy: xxx Model • /model L Default Opus 4 for up to 50% of usage limits, then use Sonnet 4 (currently Opus)
Finally this worked for me: I used claude --model claude-sonnet-4-20250514 instead of claude
@goodCircle The system says you are on a Claude Pro plan. You will need to run /logout and /login to refresh the credentials.
Same issue but i /logout and /login and everything works
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/2909
- https://github.com/anthropics/claude-code/issues/4726
- https://github.com/anthropics/claude-code/issues/3008
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This issue has been automatically closed as a duplicate of #2909.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.