[BUG] --brief mode silently swallows authentication errors (401), showing no output
Environment
- Claude Code CLI with
--briefflag - Any authentication method (OAuth)
Bug Description
When running Claude Code with --brief mode and the OAuth token has expired (or any other authentication error occurs), the CLI outputs nothing at all instead of displaying the error. This causes users to repeatedly retry their prompts thinking it's a transient issue, when in reality they need to re-authenticate.
Without --brief, the error is properly shown:
Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CZCUmznbR6ccUSaYECZJA"}
With --brief, there is no output at all.
Steps to Reproduce
- Authenticate with Claude Code via OAuth
- Wait for the OAuth token to expire (or manually invalidate it)
- Run
claude --brief "any prompt" - Observe: no output is produced
- Run
claude "any prompt"(without --brief) - Observe: the authentication error is now visible
Expected Behavior
Even in --brief mode, critical errors like authentication failures (401), rate limits (429), and other API errors should be emitted to stderr so users can diagnose and fix the issue.
Actual Behavior
--brief mode produces no output when authentication fails, making it impossible to diagnose the issue without switching output modes.
Suggested Fix
Ensure that API errors (especially 4xx/5xx responses) are always written to stderr regardless of output mode. The --brief flag should only suppress non-essential output (progress indicators, thinking, intermediate steps), not critical error messages.
Related
- Slack thread: https://anthropic.slack.com/archives/C07VBSHV7EV/p1773941819420129?thread_ts=1773925644.510169&cid=C07VBSHV7EV
- The
StopFailurehook event (added in 2.1.78) fires on API errors, but this doesn't help with CLI output in brief mode
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗