EPIPE Crash When Running Claude Code in Python Project Directory

Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 14 comments · opened Feb 24, 2025 · closed Feb 26, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
I keep getting EPIPE related crashes when running Claude Code in my Python project directory

e.g.: ❯ claude
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:159:15)
at writeGeneric (node:internal/stream_base_commons:150:3)
at Socket._writeGeneric (node:net:971:11)
at Socket._write (node:net:983:8)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.write (node:internal/streams/writable:508:10)
at m8.sendToShell (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:243)
at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:337:1614
at new Promise (<anonymous>) {
errno: -32,
code: 'EPIPE',
syscall: 'write'

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 0.2.9
  • Feedback ID: 84e869fe-5511-44c8-8fb0-d9652126fc9c

View original on GitHub ↗

14 Comments

darinkishore · 1 year ago

I get similar errors. Generally, when using bash, it crashes or times out. haven't gotten any bash commands to work yet.

book-5:mental darin$ claude --verbose
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│                                            │
│   /help for help                           │
│                                            │
│   cwd: /Users/darin/Projects/mental        │
╰────────────────────────────────────────────╯

! echo 'hey'
  ⎿  Command execution timed out
     Exit code 143

> /doctor
  ⎿  Set verbose to true

> /config

! echo 'hello'

· Conjuring… (0s · esc to interrupt)

  ! for bash mode · / for commands · esc to undo                                                                                                                              \⏎ for newline


Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:159:15)
    at writeGeneric (node:internal/stream_base_commons:150:3)
    at Socket._writeGeneric (node:net:971:11)
    at Socket._write (node:net:983:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at m8.sendToShell (file:///Users/darin/.npm-packages/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:243)
    at file:///Users/darin/.npm-packages/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:337:1614
    at new Promise (<anonymous>) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Total cost: $0.0002
Total duration (API): 1.1s
Total duration (wall): 52.3s
corv89 · 1 year ago

I would like to know how to reset Claude Code because it did work initially (with errors)

Removing $HOME/.claude did not solve it

mssoka · 1 year ago

same issue here.

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:159:15)
    at writeGeneric (node:internal/stream_base_commons:150:3)
    at Socket._writeGeneric (node:net:971:11)
    at Socket._write (node:net:983:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at m8.sendToShell (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:243)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:337:1614
    at new Promise (<anonymous>) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

~/c/xpost ❯❯❯ node -v                                                                                       ✘ 1 main
v23.7.0
~/c/xpost ❯❯❯ npm -v                                                                                            main
11.1.0
~/c/xpost ❯❯❯
mssoka · 1 year ago

works with sudo though

~/c/xpost ❯❯❯ sudo claude                                                                                   ✘ 1 main
Password:
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│                                            │
│   /help for help                           │
│                                            │
│   cwd: /Users/moses/code/xpost             │
╰────────────────────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "create a util logging.py that..."                                                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ! for bash mode · / for commands · esc to undo                                                    \⏎ for newline
wolffiex collaborator · 1 year ago

I think we have a fix for this coming in the next release, unless this is a separate issue. Does it help if you go

SHELL=/bin/bash claude

mssoka · 1 year ago

thanks that worked.

SHELL=/bin/bash claude                                                                            main
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│                                            │
│   /help for help                           │
│                                            │
│   cwd: /Users/moses/code/xpost             │
╰────────────────────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "how do I log an error?"                                                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ! for bash mode · / for commands · esc to undo                                                    \⏎ for newline
wolffiex collaborator · 1 year ago

awesome! I'll push a new release right now

darinkishore · 1 year ago

@wolffiex had the same issue, sudo fixed it, but setting SHELL didn't!

wolffiex collaborator · 1 year ago

Ok thanks for the report. The shell is finicky beast. We are adding some
logic to fix the case that is addressed by the workaround I posted. For the
folks who need to run sudo, I'm adding some logging that hopefully help us
track this down.

On Tue, Feb 25, 2025 at 1:52 PM Darin @.***> wrote:

@wolffiex <https://github.com/wolffiex> had the same issue, sudo fixed it, but setting SHELL didn't! — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/31#issuecomment-2683378650>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABUJ7AE4HTHO5D6EIODJYL2RTQ3PAVCNFSM6AAAAABXZC7TN6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBTGM3TQNRVGA> . You are receiving this because you were mentioned.Message ID: @.***> [image: darinkishore]darinkishore left a comment (anthropics/claude-code#31) <https://github.com/anthropics/claude-code/issues/31#issuecomment-2683378650> @wolffiex <https://github.com/wolffiex> had the same issue, sudo fixed it, but setting SHELL didn't! — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/31#issuecomment-2683378650>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABUJ7AE4HTHO5D6EIODJYL2RTQ3PAVCNFSM6AAAAABXZC7TN6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBTGM3TQNRVGA> . You are receiving this because you were mentioned.Message ID: @.***>
kruzer · 1 year ago

I use fish as a shell, but starting with

SHELL=/bin/bash claude

solved the problem for me

corv89 · 1 year ago

@wolffiex Thanks for the quick fix!

I can confirm it works since the update (without workarounds)

darinkishore · 1 year ago
Ok thanks for the report. The shell is finicky beast. We are adding some logic to fix the case that is addressed by the workaround I posted. For the folks who need to run sudo, I'm adding some logging that hopefully help us track this down. […](#)

@wolffiex
Thank you! Is there any way I can get those logs to you?

abooo96 · 1 year ago

This has been bugging me for days!!

SHELL=/bin/bash claude works perfectly. Thank you.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.