[BUG] OAuth login fails with "Failed to start OAuth callback server: Failed to start server. Is port 0 in use?

Resolved 💬 4 comments Opened Feb 21, 2026 by s-celles Closed Feb 21, 2026

Preflight Checklist

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

What's Wrong?

Hello,

Steps to reproduce:

  1. Run claude
  2. Execute /login
  3. Error appears immediately
❯ test 
  ⎿  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_011CYMDHeNYmSgx9MxiJhzrf"} · Please run /login

❯ /login  

 OAuth error: Failed to start OAuth callback server: Failed to start server. Is port 0 in use?

Environment:

  • Claude Code version: [run claude --version]

❯ claude --version
2.1.50 (Claude Code)

  • OS: [e.g., macOS 14.2, Ubuntu 22.04, Windows 11]

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

  • Shell: [e.g., bash, zsh, PowerShell]

Bash

  • Installation method: [native/npm/homebrew]

Native

Additional context:

  • Previous login attempt was interrupted
  • Token expired with 401 authentication error
  • No other Claude Code instances running

Expected behavior:
OAuth flow should open browser for authentication.

What Should Happen?

Claude should allow me to login without issue

Error Messages/Logs

Steps to Reproduce

Can't know

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.50

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗