anthropics / anthropics/claude-code

[BUG] Windows: `claude auth login` / OAuth browser doesn't open automatically in Git Bash — no fallback to cmd.exe /c start (regression since 2.1.141)

オープン
#89,284 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?

On Windows, `claude auth login` (and any other OAuth flow driven by the CLI, e.g. `/mcp` authentication) does not open the default browser automatically when running from a Git Bash (MSYS2/MINGW64) shell. The command prints the login URL and device code, and the user has to copy-paste them by hand.

This used to work — the browser opened automatically in earlier versions. It broke as a regression starting with v2.1.141 (auto-update, 2026-05-14): the browser-open logic changed and, in a Git Bash session where `BROWSER` and `DISPLAY` are unset, there is no fallback to `cmd.exe /c start` anymore. The equivalent issue for MCP auth in the same environment (#59194) documents the same regression and root cause, but was auto-closed as stale/"not planned" without a fix; the underlying `claude auth login` case (not just MCP) is still broken.

### What Should Happen?

On Windows, when `BROWSER` is unset and there's no `DISPLAY` (i.e. a normal Git Bash session, not X11), the CLI should fall back to `cmd.exe /c start "" ` (or an equivalent native Windows browser-open call), the same way it apparently did before v2.1.141, instead of silently doing nothing and leaving the user to copy-paste the URL by hand.

### Error Messages/Logs

```shell
No error is printed — the CLI prints the OAuth URL and device code as normal and waits for the code, it just never spawns a browser process. Confirmed via Task Manager: no new browser process appears after running `claude auth login`.
```

### Steps to Reproduce

1. On Windows, open Git Bash (MINGW64) — the default shell bundled with Git for Windows.
2. Do not set a `BROWSER` environment variable.
3. Run `claude auth login`.
4. Expected: the default browser (Chrome, correctly registered as the Windows default handler for http/https on this machine) opens automatically to the OAuth URL.
5. Actual: nothing opens. The CLI prints the URL and code and waits; the user has to copy the URL into a browser by hand and then copy the resulting code back into the terminal.
6. Workaround that restores the old behavior: add `{ "env": { "BROWSER": "cmd.exe /c start \"\"" } }` to `~/.claude/settings.json`, as documented in the comments on #59194. This should not be necessary — it worked with zero configuration before v2.1.141.

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

2.1.139

### Claude Code Version

2.1.237 (Claude Code)

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

Other

### Additional Information

This is the `claude auth login` / general OAuth-CLI-flow instance of the exact regression described in #59194 ("OAuth browser does not open for HTTP MCP servers on Windows"), which was auto-closed as stale/"not planned" in June without a fix. Filing separately since #59194 is closed and the underlying regression (no `cmd.exe` fallback since 2.1.141 in a Git-Bash/no-DISPLAY environment) is still present for at least the `claude auth login` flow, not just MCP auth. Also closed/related: #44350 (dup), #30902 (dup).

Workaround for anyone hitting this in the meantime: `~/.claude/settings.json` → `{ "env": { "BROWSER": "cmd.exe /c start \"\"" } }` (the empty quotes after `start` are required — that's the window-title argument `start` expects). Would be good if this became the default behavior on Windows again rather than something every affected user has to independently discover and configure by hand.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reproducing `claude auth login` in Windows Git Bash with `BROWSER` and `DISPLAY` unset, then trace the CLI's OAuth browser-opening path and its Windows handling. Done means the default browser opens automatically through a native Windows fallback, while the existing login URL and code flow still work.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
bash, python
領域
authentication, cli, operating-systems
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。