Skip to content

[BUG] Auth conflict: Both a token (CLAUDE_CODE_OAUTH_TOKEN) and an API key (apiKeyHelper) are set #11587

Description

@passos

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

I'm logging in with my Claude account. When I start claude, I get the following warning:

⚠ Auth conflict: Both a token (CLAUDE_CODE_OAUTH_TOKEN) and an API key (apiKeyHelper) are set. This may
   lead to unexpected behavior.
    • Trying to use CLAUDE_CODE_OAUTH_TOKEN? Unset the apiKeyHelper setting.
    • Trying to use apiKeyHelper? Unset the CLAUDE_CODE_OAUTH_TOKEN environment variable

If I continue to input anything, claude reports error

  ⎿  Invalid API key · Fix external API key

the `/status' shows

 Account
  L Auth Token: CLAUDE_CODE_OAUTH_TOKEN
  L API Key: apiKeyHelper

I don’t have any Claude API key variable set in my environment. I checked the settings file at
/Library/Application Support/ClaudeCode/managed-settings.json and found this entry:

"apiKeyHelper": "/usr/local/bin/claude_code/api-key-helper"

claude works if I remove the apiKeyHelper entry from the settings.

Also, the script at /usr/local/bin/claude_code/api-key-helper references /usr/local/bin/clicat, which doesn’t exist on my machine.

What Should Happen?

the claude should work without shows any warning or error message.

Error Messages/Logs

$ claude
 ⚠ Auth conflict: Both a token (CLAUDE_CODE_OAUTH_TOKEN) and an API key (apiKeyHelper) are set. This may
   lead to unexpected behavior.
    • Trying to use CLAUDE_CODE_OAUTH_TOKEN? Unset the apiKeyHelper setting.
    • Trying to use apiKeyHelper? Unset the CLAUDE_CODE_OAUTH_TOKEN environment variable.

> test
  ⎿  Invalid API key · Fix external API key


$ claude --version
Error getting API key from apiKeyHelper (in settings or ~/.claude.json): apiKeyHelper did not return a valid value
1.0.72 (Claude Code)

Steps to Reproduce

  1. login with claude account
  2. run claude

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

1.0.72 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions