Invalid Model Name in Claude Code API Request

Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 6 comments · opened Jul 3, 2025 · closed Jul 5, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
I'm receiving an API error when running Claude Code from my directory containing 'container' and 'containerizaiton' :

so what kind of images can apple container use?

⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid
model name"}}

/login

⎿  Login successful

so what kind of images can apple container use?

⎿ 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.41
  • Feedback ID: e06caeeb-bfd8-4d7f-8e46-35f7fede0724

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at __node_internal_genericNodeError (node:internal/errors:867:15)\n    at checkExecSyncError (node:child_process:885:11)\n    at execSync (node:child_process:957:15)\n    at JI (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n    at file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9038\n    at Q (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at _X (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8184)\n    at w_ (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7265)\n    at U9 (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11432)\n    at dpA (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11590)","timestamp":"2025-07-03T20:59:55.230Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at wY (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1489:1184)\n    at file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1489:912\n    at Array.map (<anonymous>)\n    at AH (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1489:903)\n    at uT2 (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1958:9690)\n    at ZU (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19802)\n    at UP (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42556)\n    at wP (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38105)\n    at o$ (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38033)\n    at MU (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:37887)","timestamp":"2025-07-03T20:59:57.817Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"system: Invalid model name\"}}\n    at J5.generate (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1315:12578)\n    at Tq.makeStatusError (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1332:2100)\n    at Tq.makeRequest (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1332:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async WM2.zA1.showErrors (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:23051)\n    at async zA1 (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:12633)\n    at async WM2 (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:22899)\n    at async file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:18023\n    at async EAA (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:5121)\n    at async tu (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1701:17993)","timestamp":"2025-07-03T21:00:32.868Z"},{"error":"Error: Command failed: security delete-generic-password -a $USER -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at __node_internal_genericNodeError (node:internal/errors:867:15)\n    at checkExecSyncError (node:child_process:885:11)\n    at execSync (node:child_process:957:15)\n    at JI (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n    at mpA (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:10150)\n    at hpA (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:10024)\n    at p9A (file:///Users/ken/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2158:2567)\n   

Note: Error logs were truncated.

View original on GitHub ↗

6 Comments

dicksontsai collaborator · 1 year ago

Did you try /logout -> /login? Claude Code does not automatically receive updates to your subscription status.

meefs · 1 year ago

@dicksontsai I logged in again and got the same result. I also attempted to start a new session in the same directory and got the same error. If I start a new session in another directory (not container / containerization) I connect as expected.

update

I attempted to recreate the behavior and the error is no longer present. I didn't make any changes to my environment or otherwise cause the error to go away so its unclear what was going on over the past 24 hours which resulted in the errant behavior from Claude Code.

dicksontsai collaborator · 1 year ago

The login credentials are stored at the user level (spans multiple directories), unless you use the environment variable CLAUDE_CONFIG_DIR. It seems that this issue is resolved.

meefs · 1 year ago

@dicksontsai my issue with authentication was limited to two specific directories and the initial timeframe that I reported it on July 3rd. There was no issue in using Claude Code outside of these two directories and after some time had passed I was able to once again use Claude Code inside of the two affected directories. What would have caused the behavior of 'API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}' to be shown?

Thanks

dicksontsai collaborator · 1 year ago

_Disclaimer: This is conjecture, since I don't have visibility into your setup._
It's possible that the login state was stale, but the OAuth token expired after a while, triggering a refresh that corrected your login state.

github-actions[bot] · 1 year ago

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.