claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Invalid API key · Please run /login

Open sylvain-wei opened this issue 1 year ago • 4 comments

Bug Description

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 1.0.53
  • Feedback ID:

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 genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:883:11)\n    at execSync (node:child_process:955:15)\n    at AI (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:728:6320)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:640:16554\n    at Q (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:14406)\n    at MF (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:640:14339)\n    at zX (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:640:13205)\n    at MB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:640:19174)","timestamp":"2025-07-17T15:47:48.763Z"},{"error":"Error: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the \"X-Api-Key\" or \"Authorization\" headers to be explicitly omitted\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1188:6454","timestamp":"2025-07-17T15:47:50.580Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:518:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:561:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n    at Readable.push (node:internal/streams/readable:392:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-07-17T15:47:50.717Z"},{"error":"Error: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the \"X-Api-Key\" or \"Authorization\" headers to be explicitly omitted\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1188:6454\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-17T15:48:11.464Z"}]

sylvain-wei avatar Jul 17 '25 15:07 sylvain-wei

This issue is still happening I'm noticing it happens every day maybe 24 hours? The way I fix it is:

  1. Uninstall Claude Code
  2. Install 1.00.67
  3. LogIn
  4. /Exit
  5. Open Claude Code

This resolves the problem temporarily for at least 24 hours.

Seeing most people have this problem with SSH and mosh.

titofebus avatar Aug 08 '25 12:08 titofebus

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 06 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 06 '26 10:01 github-actions[bot]

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.

github-actions[bot] avatar Jan 14 '26 14:01 github-actions[bot]