[BUG] `Invalid count value` crash at String.repeat

Resolved 💬 2 comments Opened Apr 11, 2026 by jungsehui202 Closed May 24, 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?

Bug: Invalid count value crash at String.repeat

Environment:

  • Claude Code version: claude --version 2.1.101 (Claude Code)
  • Node.js: v18.20.8
  • OS: macOS
  • Terminal: (iTerm2 / Terminal.app / VS Code integrated terminal)

Error:

  • ERROR Invalid count value

at String.repeat (<anonymous>)
Nw7 (cli.js:8181:207)
MY (cli.js:546:20977)
Bw (cli.js:546:39511)

Reproduction:

  • Occurs intermittently during normal usage
  • Seems related to terminal width calculation when rendering output
  • CLI crashes immediately with no recovery option

Expected behavior:
CLI should handle edge cases in terminal width gracefully (e.g., clamp negative values to 0) instead of crashing.

Workaround:
Restart CLI with claude or claude --resume <session-id>

What Should Happen?

Claude should resolve a Crash Error

Error Messages/Logs

claude

  ERROR  Invalid count value

 -     at String.repeat
   (<anonymous>)
 -Nw7 (file:///Users/linkare
     er_123/.nvm/versions/no
     de/v18.20.8/lib/node_mo
     dules/@anthropic-ai/cla
     ude-code/cli.js:8181:20
     7)
 -MY (file:///Users/linkaree
    r_123/.nvm/versions/node
    /v18.20.8/lib/node_modul
    es/@anthropic-ai/claude-
    code/cli.js:546:20977)

 -Bw (file:///Users/linkaree
    r_123/.nvm/versions/node
    /v18.20.8/lib/node_modul
    es/@anthropic-ai/claude-
    code/cli.js:546:39511)

 -gk (file:///Users/linkaree
    r_123/.nvm/versions/node
    /v18.20.8/lib/node_modul
    es/@anthropic-ai/claude-
    code/cli.js:546:50203)

 -$P6 (file:///Users/linkare
     er_123/.nvm/versions/no
     de/v18.20.8/lib/node_mo
     dules/@anthropic-ai/cla
     ude-code/cli.js:546:868
     94)
 -ZI6 (file:///Users/linkare
     er_123/.nvm/versions/no
     de/v18.20.8/lib/node_mo
     dules/@anthropic-ai/cla
     ude-code/cli.js:546:858
     56)
 -fI6 (file:///Users/linkare
     er_123/.nvm/versions/no
     de/v18.20.8/lib/node_mo
     dules/@anthropic-ai/cla
     ude-code/cli.js:546:856
     77)
 -zP6 (file:///Users/linkare
     er_123/.nvm/versions/no
     de/v18.20.8/lib/node_mo
     dules/@anthropic-ai/cla
     ude-code/cli.js:546:824
     25)
 -g6 (file:///Users/linkaree
    r_123/.nvm/versions/node
    /v18.20.8/lib/node_modul
    es/@anthropic-ai/claude-
    code/cli.js:546:6477)


^C%

Steps to Reproduce

  1. Open Claude Code CLI in a terminal
  2. Use normally (no specific trigger identified)
  3. CLI crashes with Invalid count value at String.repeat
  4. No recovery - CLI exits immediately

Note: Occurs intermittently. Suspected cause: negative value passed to
String.repeat() during terminal width calculation for output rendering.
The minified stack trace points to UI rendering code (cli.js:8181).

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.101 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

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