Skip to content

[BUG] Claude Code Session Freeze on Large File Read Error (v2.1.1 - v2.1.3) #17394

@fxpro32

Description

@fxpro32

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Bug Report: Claude Code Session Freeze on Large File Read Error (v2.1.1 - v2.1.3)

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

Environment

  • Platform: Linux
  • Terminal: WezTerm
  • Claude Code Version: 2.1.2, 2.1.3 (regression from 2.1.0)
  • Node.js: v22

Bug Description

Claude Code completely freezes/hangs when the Read tool encounters a file larger than 256KB and returns an error. The session becomes unresponsive - no keyboard input works, Ctrl+C is ignored, and the only recovery is to force-kill the terminal.

Key observation: Version 2.1.0 handles this gracefully (shows error and continues). Versions 2.1.2 and 2.1.3 freeze completely.

Steps to Reproduce

  1. Start Claude Code v2.1.1 or later
  2. Have a file larger than 256KB in your project (e.g., a 600KB+ source file)
  3. Ask Claude to analyze or read the file
  4. Claude attempts to use the Read tool
  5. Read tool returns error: Error: File content (XXX.XKB) exceeds maximum allowed size (256KB)
  6. Session freezes completely - no further input possible

Expected Behavior

Claude Code should:

  1. Display the error message to the user
  2. Suggest alternatives (use head, tail, grep, or offset/limit parameters)
  3. Continue accepting input normally

This is how v2.1.0 behaves.

Actual Behavior

After the Read tool error:

  • Terminal becomes completely unresponsive
  • Cannot type any input
  • Ctrl+C does not interrupt
  • Escape key does not work
  • Session is stuck on "Perusing..." or similar state
  • Only recovery is force-killing the process/terminal

Console Output Before Freeze

● Read(/tmp/largefile.txt)
  ⎿  Error: File content (600.0KB) exceeds maximum allowed size (256KB). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.
● Bash(wc -l /tmp/largefile.txt && head -100 /tmp/largefile.txt)
  ⎿  Running…
* Perusing… (ctrl+c to interrupt · 34s · ↓ 1.3k tokens · thought for 1s)
  [FROZEN - no further response]

Regression Information

Version Status
2.1.0 ✅ Works - handles error gracefully
2.1.1 ❓ Not tested
2.1.2 ❌ Freezes
2.1.3 ❌ Freezes

Workaround

Pin to version 2.1.0:

npm install -g @anthropic-ai/claude-code@2.1.0

And disable auto-updater:

export DISABLE_AUTOUPDATER=1

Related Issues

Additional Context

This appears to be a regression in error handling for the Read tool. The 256KB limit itself is fine, but the error path seems to leave Claude Code in an unrecoverable state in versions after 2.1.0.

What Should Happen?

What's Wrong? (Bug Description)

Claude Code completely freezes/hangs when the Read tool encounters a file larger than 256KB and returns an error. The session becomes unresponsive - no keyboard input works, Ctrl+C is ignored, and the only recovery is to force-kill the terminal.

Key observation: Version 2.1.0 handles this gracefully (shows error and continues). Versions 2.1.2 and 2.1.3 freeze completely.

Console Output Before Freeze

● Read(/tmp/largefile.txt)
  ⎿  Error: File content (600.0KB) exceeds maximum allowed size (256KB). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.
● Bash(wc -l /tmp/largefile.txt && head -100 /tmp/largefile.txt)
  ⎿  Running…
* Perusing… (ctrl+c to interrupt · 34s · ↓ 1.3k tokens · thought for 1s)
  [FROZEN - no further response]

After the Read tool error:

  • Terminal becomes completely unresponsive
  • Cannot type any input
  • Ctrl+C does not interrupt
  • Escape key does not work
  • Session is stuck on "Perusing..." or similar state
  • Only recovery is force-killing the process/terminal

Regression Information

Version Status
2.1.0 ✅ Works - handles error gracefully
2.1.1 ❓ Not tested
2.1.2 ❌ Freezes
2.1.3 ❌ Freezes

What should happen? (Expected Behavior)

When the Read tool encounters a file larger than 256KB, Claude Code should:

  1. Display the error message to the user
  2. Suggest alternatives (use head, tail, grep, or offset/limit parameters)
  3. Continue accepting input normally and remain responsive

This is the behavior observed in v2.1.0 - the error is shown but the session remains fully functional.


Steps to Reproduce

  1. Start Claude Code v2.1.2 or v2.1.3
  2. Have a file larger than 256KB in your project (e.g., a 600KB+ source file)
  3. Ask Claude to analyze or read the file
  4. Claude attempts to use the Read tool
  5. Read tool returns error about file exceeding 256KB limit
  6. Session freezes completely - no further input possible

Claude Code Version

2.1.3


Platform (select one)

Anthropic API


Operating System

Linux


Terminal

WezTerm


Additional Context / Workaround

Workaround: Pin to version 2.1.0 and disable auto-updater:

npm install -g @anthropic-ai/claude-code@2.1.0
export DISABLE_AUTOUPDATER=1

Related Issues:

This appears to be a regression in error handling for the Read tool. The 256KB limit itself is fine, but the error path seems to leave Claude Code in an unrecoverable state in versions after 2.1.0.

Error Messages/Logs

2026-01-09T22:35:28.612Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-09T22:35:28.612Z [DEBUG] Found 0 hook matchers in settings
2026-01-09T22:35:28.612Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-09T22:35:28.627Z [ERROR] Error: Error: File content (629.1KB) exceeds maximum allowed size (256KB). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.
    at Object.call (file:///home/node/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:973)
    at VY7 (file:///home/node/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3362:27242)
2026-01-09T22:35:28.635Z [DEBUG] Getting matching hook commands for PostToolUseFailure with query: Read
2026-01-09T22:35:28.635Z [DEBUG] Found 0 hook matchers in settings
2026-01-09T22:35:28.635Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-09T22:35:28.649Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-09T22:35:28.649Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-09T22:35:28.649Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-09T22:35:28.649Z [DEBUG] Hooks: checkForNewResponses returning 0 responses


Session froze after this point - no further log entries, terminal completely unresponsive.

Steps to Reproduce

  1. Install Claude Code v2.1.2 or v2.1.3:

    npm install -g @anthropic-ai/claude-code@2.1.3
  2. Create a large test file (>256KB):

    mkdir test-project && cd test-project
    yes "This is a line of text to make the file large enough to trigger the bug." | head -10000 > largefile.txt
    ls -lh largefile.txt  # Should show ~600KB+
  3. Start Claude Code:

    claude
  4. Ask Claude to read the file:

    Please read and analyze largefile.txt
    
  5. Claude will attempt to use the Read tool and receive the error:

    Error: File content (XXX.XKB) exceeds maximum allowed size (256KB)
    
  6. Observe: After the error appears, the session freezes completely:

    • Cannot type any input
    • Ctrl+C does not work
    • Escape key does not work
    • Must force-kill the terminal to exit

Note: This issue does NOT occur in v2.1.0 - the error is displayed but the session remains responsive.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.0

Claude Code Version

2.1.3

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

Workaround: Pin to version 2.1.0 and disable auto-updater:
npm install -g @anthropic-ai/claude-code@2.1.0
export DISABLE_AUTOUPDATER=1

Related Issues:

The 256KB file size limit itself is fine - the issue is that the error handling path leaves the UI in an unrecoverable frozen state. In v2.1.0, the same error is displayed but the session remains fully responsive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions