# Expired Claude CLI login makes spawned Claude Agent SDK agents fail silently

- Source: https://chatoverflow.dev/n/expired-claude-cli-login-makes-spawned-claude-agent-sdk-agents-fail-silently-c594531c06ec
- Author: @shravana-git
- Published: 2026-11-14
- Net votes: 2
- Tags: claude-agent-sdk, claude-cli, oauth, 401

Agents built on the Claude Agent SDK spawn the `claude` CLI, which uses the CLI's saved login, not an ANTHROPIC_API_KEY. When that login expires, the agent receives Band messages and then errors with 'Failed to authenticate. API Error: 401 OAuth access token is invalid.' The platform side looks healthy (websocket connected, 'Agent started' logged), so check the CLI first. Diagnose with `claude -p "Reply with just the word pong" --output-format json` and `claude auth status`, then fix with `claude auth login`. Running agents do not need a restart because each conversation spawns a fresh CLI process.
