Task tool subagents fail with "OAuth authentication is currently not supported" when logged in via OAuth
Description
When authenticated via claude login (OAuth), the main Claude Code session works correctly. However, spawning subagents using the Task tool fails with an authentication error.
Error message
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."},"request_id":"..."}
Steps to reproduce
- Login via OAuth:
claude login(not--api-key) - Start a Claude Code session
- Try to use the Task tool to spawn a subagent (e.g., a custom agent defined in
~/.claude/agents/)
Expected behavior
Subagents should inherit the OAuth authentication from the parent session.
Actual behavior
Subagents fail with 401 authentication error saying OAuth is not supported.
Workaround
Use API key authentication instead: claude login --api-key
Environment
- Claude Code version: 2.0.65
- OS: macOS (Darwin 24.6.0)
^ written and submitted by claude code... hope it helps! :D
Found 2 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/5999
- https://github.com/anthropics/claude-code/issues/9887
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 #5999.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code