claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude crashes if interrupted during command execution

Open ajwrigley opened this issue 1 month ago • 1 comments

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?

If I interrupt Claude while it's in the process of running a long-running Bash tool call, it crashes the process. This only seems to happen if manually interrupted (ESC) and only if Bash is running.

What Should Happen?

Claude should interrupt and continue the conversation as normal without crashing the process.

Error Messages/Logs

153 | Total duration (API):  ${YQ(gV())}
154 | Total duration (wall): ${YQ(HYT())}
155 | Total code changes:    ${vCT()} ${vCT()===1?"line":"lines"} added, ${gCT()} ${gCT()===1?"line":"lines"} removed
156 | ${R}`)}function ve9(){xe9.useEffect(()=>{let T=()=>{if(X9R())process.stdout.write(`
157 | `+PnR()+`
158 | `);wnR()};return process.on("exit",T),()=>{process.off("exit",T)}},[])}function IFH(T,R){return Math.round(T*R)/R}function Q9R(T,R,A){ngA(T,R,A),BuA()?.add(T,{model:A}),CYT()?.add(R.input_tokens,{type:"input",model:A}),CYT()?.add(R.output_tokens,{type:"output",model:A}),CYT()?.add(R.cache_read_input_tokens??0,{type:"cacheRead",model:A}),CYT()?.add(R.cache_creation_input_tokens??0,{type:"cacheCreation",model:A})}var xe9;var $z=X(()=>{t_();T0();X9();lA();lA();lA();xe9=S(HT(),1)});function QFH(T,R){return R.input_tokens/1e6*T.inputTokens+R.output_tokens/1e6*T.outputTokens+(R.cache_read_input_tokens??0)/1e6*T.promptCacheReadTokens+(R.cache_creation_input_tokens??0)/1e6*T.promptCacheWriteTokens+(R.server_tool_use?.web_search_requests??0)*T.webSearchRequests}function XFH(T){return T.input_tokens+(T.cache_read_input_tokens??0)+(T.cache_creation_input_tokens??0)}function ZFH(T,R){let A=EE(T),D=ge9[A];if(D===eAT&&XFH(R)>200000)return ynR;if(!D)return o("tengu_unknown_model_cost",{model:T,shortName:A}),xzR(),ge9[EE(me9 | ... truncated

SystemError: kill() failed: EPERM: Operation not permitted
 syscall: "kill",
   errno: 1,
    code: "EPERM"

Steps to Reproduce

  1. Open Claude on a codebase
  2. Ask Claude to run tests or some other long-running command
  3. Hit ESC

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.0.72 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

No response

ajwrigley avatar Dec 29 '25 08:12 ajwrigley

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/15264
  2. https://github.com/anthropics/claude-code/issues/2362
  3. https://github.com/anthropics/claude-code/issues/9745

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 29 '25 08:12 github-actions[bot]

This issue has been automatically closed as a duplicate of #15264.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Jan 01 '26 09:01 github-actions[bot]

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.

github-actions[bot] avatar Jan 08 '26 14:01 github-actions[bot]