[BUG] Claude Code hanging after a second

Resolved 💬 3 comments Opened Aug 14, 2025 by deamitzogi1 Closed Aug 19, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.80
  • Operating System: Amazon Linux 2

Bug Description

I'm trying to programmatically create a VM, run xyz steps, programmatically install Claude Code CLI and finally run some prompts. I have got to the part of executing some prompts and Claude just hangs. When I run through the workflow locally (installing claude code, asking it to write e.g., the Fibonacci function in Python) it works perfectly fine, but it does not on my VM:

Debugger in my VM:

[DEBUG] Writing to temp file: /tmp/claude-npm/.claude.json.tmp.629.1755091804886
[DEBUG] Preserving file permissions: 100644
[DEBUG] Temp file written successfully, size: 668 bytes
[DEBUG] Applied original permissions to temp file
[DEBUG] Renaming /tmp/claude-npm/.claude.json.tmp.629.1755091804886 to /tmp/claude-npm/.claude.json
[DEBUG] File /tmp/claude-npm/.claude.json written atomically
hangs...

Debugger locally:

[DEBUG] Writing to temp file: /Users/user/.claude.json.tmp.13729.1755164294380
[DEBUG] Preserving file permissions: 100644
[DEBUG] Temp file written successfully, size: 23088 bytes
[DEBUG] Applied original permissions to temp file
[DEBUG] Renaming /Users/user/.claude.json.tmp.13729.1755164294380 to /Users/user/.claude.json
[DEBUG] File /Users/user/.claude.json written atomically
[DEBUG] Creating shell snapshot for zsh (/bin/zsh)
[DEBUG] Creating snapshot at: /Users/user/.claude/shell-snapshots/snapshot-zsh-1755164294503-jltolt.sh
[DEBUG] Writing to temp file: /Users/user/.claude/todos/a0890f82-84e0-4141-824c-e6e72035cbd3-agent-a0890f82-84e0-4141-824c-e6e72035cbd3.json.tmp.13729.1755164294506
... (the rest of claude -p "" execution debugging)

Hence why I believe it is something to do with this shell snapshot (or the shell in general).

What is the problem here?

Steps to Reproduce

  1. Install claude using npm programmatically
  2. run claude -p "Any prompt"

Expected Behavior

Claude to output "Balance too low" or something along those lines

Actual Behavior

Hangs

View original on GitHub ↗

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