[BUG] gcloud API commands hang indefinitely on Windows — local commands work fine
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?
Details:
Claude Code v2.1.90, Windows 10 (26200.8037)
gcloud --version works (local)
gcloud auth print-access-token works (local)
gcloud projects list --limit=1 hangs (API call)
gcloud run services list hangs (API call)
gcloud logging read hangs (API call)
Same commands work in CMD/PowerShell outside Claude Code
The Python SDK (google-cloud-run) also works in PyCharm terminal
Any gcloud command that makes an HTTP API call to GCP hangs indefinitely in Claude Code's bash tool on Windows. The command never returns output and eventually times out. Local gcloud commands (no network call) work fine.
Commands that work:
gcloud --version(reads local file)gcloud auth print-access-token(reads cached token)
Commands that hang forever:
gcloud projects list --limit=1gcloud run services list --region=us-central1 --project=********** --limit=1gcloud run services update discord-bot --update-env-vars="..." --region=us-central1 --project=********gcloud logging read "resource.type=cloud_run_revision" --project=*********** --limit=1 --freshness=5m --format=json
All of these commands work correctly in CMD, PowerShell, and PyCharm terminal outside of Claude Code. Auth is valid (print-access-token returns a token). The issue appears to be Claude Code's subprocess I/O handler not capturing output from processes that make HTTP requests and wait for responses.
Adding --quiet, --format=json, wrapping in cmd /c, and redirecting stderr with 2>&1 do not fix the issue. The Python GCP SDK (google-cloud-run) works fine outside Claude Code, confirming the problem is specific to how Claude Code handles the gcloud subprocess.
What Should Happen?
gcloud API commands should execute and return their output, same as any other bash command. A command like gcloud run services list --limit=1 --project=*********** --region=us-central1 should return the service list within 5-10 seconds, not hang forever.
Error Messages/Logs
No error messages. The commands simply hang with no output until Claude Code's timeout kills them. Background task output files are also empty.
Steps to Reproduce
- Open Claude Code on Windows
- Run: gcloud --version (succeeds, confirms gcloud is installed)
- Run: gcloud auth print-access-token (succeeds, confirms auth is valid)
- Run: gcloud projects list --limit=1 (hangs indefinitely, no output)
- Open CMD or PowerShell outside Claude Code
- Run the same command: gcloud projects list --limit=1 (returns immediately)
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown exact version. User reports gcloud API commands worked in Claude Code within the past few weeks.
Claude Code Version
v2.1.90
Platform
Other
Operating System
Windows
Terminal/Shell
PyCharm terminal
Additional Information
Workaround: Using the Python GCP SDK (google-cloud-run, google-cloud-secret-manager) directly instead of shelling out to gcloud bypasses the issue. The SDK calls work in PyCharm terminal but were not tested inside Claude Code.
The gcloud spinner animation (the rotating | / - \ characters during deployment) may be related — it uses carriage returns and ANSI escape sequences that could interfere with Claude Code's output capture. However, even commands without spinners (like projects list) also hang.
Google Cloud SDK version: 561.0.0
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗