`claude --print` with tool use hangs indefinitely on Windows (Git Bash/MSYS2)

Resolved 💬 3 comments Opened Mar 29, 2026 by NewAiCoder Closed Apr 2, 2026

Summary

claude --print works fine for text-only prompts on Windows, but hangs indefinitely when the prompt triggers tool use (Read, Write, Bash). This affects any automation that relies on --print mode with tools, including the everything-claude-code observer agent.

Reproduction

# Works - no tool use needed
claude --print --model haiku -p "Say hello"
# → "hello" (responds instantly)

# Hangs forever - tool use required  
claude --print --model haiku --allowedTools "Read,Write" -p "Read the file ./test.txt and tell me how many lines it has"
# → hangs until killed

# Also hangs with --dangerously-skip-permissions
claude --print --model haiku --dangerously-skip-permissions --allowedTools "Read,Write" -p "Read ./test.txt"
# → hangs until killed

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell: Git Bash (MSYS2/MinGW)
  • CPU: AMD Ryzen 7 7800X3D
  • RAM: 64 GB DDR5

Impact

This completely blocks the continuous-learning-v2 observer agent on Windows, which spawns claude --print --model haiku --allowedTools "Read,Write" to analyze observations and create instinct files. The observer has multiple guards (timeout watchdog, session-guardian cooldown, max-turns cap) but the underlying hang means no analysis ever completes.

Related Issues

  • #18131 — API Error 400 with tool concurrency in print mode
  • #20508 — Duplicate tool_use IDs in print mode
  • #25138 — --print hangs on cold start (closed, Linux)
  • affaan-m/everything-claude-code#295 — Observer Windows hang (worked around by disabling observer on Windows)
  • affaan-m/everything-claude-code#842 — Observer temp file access on Windows

Workarounds Attempted

  • --dangerously-skip-permissions — does not fix (hang is in tool execution, not permission prompts)
  • --bare — skips auth, not usable
  • Temp file path fixes — irrelevant since the hang is before file access
  • ECC_OBSERVER_ALLOW_WINDOWS=true — bypasses the ECC Windows guard but doesn't fix the underlying hang

View original on GitHub ↗

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