[BUG] CLI crashes with "undefined is not an object (evaluating 'T.includes')" on long-running Bash tool commands

Resolved 💬 4 comments Opened Feb 17, 2026 by pythonlearner1025 Closed Mar 18, 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?

When Claude Code executes long-running commands via the Bash tool (e.g., npm run dev,
npm run dev:backend — any persistent server process), the CLI crashes with:

undefined is not an object (evaluating 'T.includes')

Short-lived commands (npm run migrate, npm run generate, etc.) work fine.
The crash is in the message rendering logic in cli.js around line 7245.

What Should Happen?

Long-running Bash tool commands should stream output without crashing. The CLI should
handle cases where message content resolves to undefined/null during rendering.

Error Messages/Logs

undefined is not an object (evaluating 'T.includes')

  Crash site in cli.js (minified), line ~7245:

    let N = typeof O === "string" ? O.trim() : _ && SWq(_) ? _.text.trim() : "(no prompt)",
        T = eo1(N);
    if (RW6(T)) { ... }        // empty-string check — doesn't catch undefined
    if (T.includes("<bash-input>")) { ... }   // CRASH — T is undefined

  The function eo1() is:
    function eo1(A) { return A.replace(FwK, "").trim() || A }

  When A is undefined/null (edge case with long-running command output), eo1() returns
  undefined, and T.includes() throws.

Steps to Reproduce

  1. Set up any Node.js project with a long-running dev server script

(e.g., npm run dev that starts Express, Vite, etc.)

  1. Run Claude Code in the project directory
  2. Ask Claude to run the long-running command, e.g.:

"Run npm run dev:backend"

  1. Claude executes it via the Bash tool
  2. CLI crashes with "undefined is not an object (evaluating 'T.includes')"

Note: Short-lived commands like npm run build or npx prisma migrate work fine.
The crash only occurs with persistent/streaming processes.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.44

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

Workaround

Adding a null guard fixes the crash:

```diff

  • T=eo1(N);if(RW6(T))
  • T=eo1(N)||"";if(RW6(T))

```

### Context

This was discovered running Claude Code as a companion agent inside
Blitz (an iOS development IDE). The IDE spawns Claude Code in a PTY
with PATH pointing to a bundled Node runtime. The crash only manifests
with long-running commands — likely because streaming output from
persistent processes creates an edge case where message content is
undefined when the CWq rendering function processes it.

### Affected versions

  • 2.1.42: All npm/node commands crash
  • 2.1.44: Short-lived commands fixed, long-running commands still crash

View original on GitHub ↗

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