Occasional crashes (cli.js:5015) in v2.1.116 during development tasks

Resolved 💬 3 comments Opened Apr 23, 2026 by jinjianzhao Closed Apr 27, 2026

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?

Claude Code v2.1.116 occasionally crashes with a JavaScript stack trace. These crashes do not happen every time but have been observed during file updates or when the CLI is processing data.

I have noted that these occasional crashes seem to occur more often when multiple Claude Code instances are running simultaneously in different terminal windows.

What Should Happen?

Open several terminal windows and start claude in each.

Perform tasks such as file updates or processing code.

Observe that, occasionally, the CLI may crash with the error in cli.js:5015.

Error Messages/Logs

"assistant"&&!h07(k))break;if(k.type==="assistant"){if(k.message.id===G.message.id){f[Z]=mJ1(k,G),W=!0;break}continue}}if(!W)f.push(G);continue}case"attachment":{let
     X=Wf6(J.attachment),L=S3("tengu_chair_sermon")?X.map(RJ1):X,P=fx(f);if(P?.type==="user"){f[f.length-1]=L.reduce((G,W)=>uJ1(G,W),P);continue}f.push(...L);continue}}}let
     z=S3("tengu_toolref_defer_j8m")?CJ1(f):f,Y=P4$(z),O=AX1(Y),M=L4$(O),w=fX1(M),D=S3("tengu_chair_sermon")?E07(pJ1(w)):w;return bJ1(D)}function uJ1(H,$){let
     q=ke$(H.message.content),K=ke$($.message.content);return{...H,message:{...H.message,content:S07(FJ1(q,K))}}}function mJ1(H,$){let
     q=[...H.message.content,...$.message.content],K=q.filter((A)=>A.type!=="text"||A.text.length===0||A.text.trim()!==""),_=K.some((A)=>A.type!=="thinking"&&A.type!=="redacted_th
     inking");return{...H,message:{...H.message,content:_?K:q}}}function h07(H){if(H.type!=="user")return!1;let $=H.message.content;if(typeof $==="string")return!1;return
     $.some((q)=>q.type==="tool_result")}function Te$(H,$){let
     q=ke$(H.message.content),K=ke$($.message.content);return{...H,uuid:H.isMeta?$.uuid:H.uuid,message:{...H.message,content:S07(BJ1(q,K))}}}function pJ1(H){let $=!1;for(let
     K=1;K<H.length;K++)if(H[K].type==="user"&&H[K-1].type==="user"){$=!0;break}if(!$)return H;let q=[];for(let K of H){let
     _=q.at(-1);if(K.type==="user"&&_?.type==="user")q[q.length-1]=Te$(_,K);else q.push(K)}return q}function S07(H){let $=[],q=[];for(let K of
     H)if(K.type==="tool_result")$.push(K);else q.push(K);return[...$,...q]}function ke$(H){if(typeof H==="string")return[{type:"text",text:H}];return H}function BJ1(H,$){let
     q=H.at(-1),K=$[0];if(q?.type==="text"&&K?.type==="text")return[...H.slice(0,-1),{...q,text:q.text+`
 5018: `},...$];return[...H,...$]}function M36(H,$){if($.length===0)return H;let q=H.content;if(Array.isArray(q)&&q.some(xg))return
      null;if(H.is_error){if($=$.filter((f)=>f.type==="text"),$.length===0)return H}if($.every((f)=>f.type==="text")&&(q===void 0||typeof q==="string")){let
      f=[(q??"").trim(),...$.map((z)=>z.text.trim())].filter(Boolean).join(`

 - H5$ (/$bunfs/root/src/entrypoints/cli.js:5015:1278)
 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:6278:14177)
 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:6278:14112)
 - y2 (/$bunfs/root/src/entrypoints/cli.js:477:30122)
 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:467:9116)
 - BE1 (/$bunfs/root/src/entrypoints/cli.js:6278:14097)
 - wD (/$bunfs/root/src/entrypoints/cli.js:477:21022)
 - CA (/$bunfs/root/src/entrypoints/cli.js:477:39569)
 - kN (/$bunfs/root/src/entrypoints/cli.js:477:50270)
 - sBH (/$bunfs/root/src/entrypoints/cli.js:477:86946)

Steps to Reproduce

Initiate a complex task (e.g., data processing or large-scale refactoring).

Allow Claude to perform several consecutive file edits.

Observe that the CLI crashes nearly every 2-3 turns, often accompanied by ConnectionRefused retries that never succeed because the local process state is corrupted.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.116 (Claude Code)

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Cursor

Additional Information

_No response_

View original on GitHub ↗

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