Claude Code crashes with v8::ToLocalChecked Error when reading files

Resolved 💬 6 comments Opened Jun 6, 2025 by divake Closed Jun 18, 2025

Bug Report: Claude Code Crashes with v8::ToLocalChecked Error When Reading Files

Issue Title

Claude Code crashes with "FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal" when attempting to read certain files

Environment

  • Claude Code Version: Latest (please check with claude --version)
  • Operating System: Linux 4.18.0-553.16.1.el8_10.x86_64
  • Platform: linux
  • Model: claude-opus-4-20250514
  • Python Environment: /home/divake/miniconda3/envs/env_cu121/bin/python
  • Working Directory: /ssd_4TB/divake/conformal-od

Description

Claude Code consistently crashes with a v8::ToLocalChecked error when attempting to read certain files. The crash occurs even when using the Read tool on files that should be safe to read.

Steps to Reproduce

  1. Navigate to a project directory with various file types
  2. Attempt to use the Read tool on files like Python scripts or test files
  3. Claude Code crashes with the following error

Error Message

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal
----- Native stack trace -----

 1: 0x7fa15a133925 node::OnFatalError(char const*, char const*) [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]
 2: 0x7fa15a75a5df v8::Utils::ReportApiFailure(char const*, char const*) [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]
 3: 0x7fa15a2a2bb4  [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]
 4: 0x7fa15a7bb206  [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]
 5: 0x7fa15a7bbd78 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]
 6: 0x7fa15a5881b6  [/home/divake/miniconda3/envs/env_cu121/bin/../lib/libnode.so.115]

----- JavaScript stack trace -----

1: readFileSync (node:fs:457:20)
2: readFileSync (file:///home/divake/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:542:728)
3: QI (file:///home/divake/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:547:375)
4: file:///home/divake/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1827:1455
5: processTicksAndRejections (node:internal/process/task_queues:95:5)

Aborted (core dumped)

Expected Behavior

Claude Code should either:

  1. Successfully read the file without crashing
  2. Gracefully handle any errors and return an appropriate error message
  3. Skip files that might cause memory issues

Actual Behavior

Claude Code crashes completely with a core dump, terminating the session.

Additional Context

  • This crash seems to occur when Claude attempts to read files, possibly related to memory management
  • The crash happens consistently, making Claude Code unusable for file operations
  • Similar issues have been reported (#1559, #1097) but this specific v8::ToLocalChecked error pattern may be different
  • The crash occurs even with files that should be safe to read (Python scripts, test files)

Workaround Attempted

Created a safe_file_utils.py module to check file safety before reading, but Claude still crashes when attempting to use the Read tool.

Impact

High - This crash prevents normal usage of Claude Code for file operations, which is a core functionality.

Suggested Fix

  1. Add proper error handling for MaybeLocal values before calling ToLocalChecked()
  2. Implement file size limits or streaming for large files
  3. Add graceful error recovery instead of crashing the entire application

View original on GitHub ↗

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