[BUG] Crash: claude --resume causes JavaScript heap out of memory error

Resolved 💬 2 comments Opened Jul 8, 2025 by GratefulDave Closed Jul 27, 2025

Environment
Platform (select one):
Other: Claude CLI
Claude CLI version: 1.45
Operating System: macOS Sequoia 15.5
Terminal: iTerm2

Bug Description

When using the claude --resume command, the CLI process crashes due to a "JavaScript heap out of memory" error. This appears to happen when the tool tries to load a large previous conversation history into memory, exceeding the default Node.js heap limit. The stack trace points to ReadFileUtf8, suggesting the issue occurs when reading the session file.

Steps to Reproduce

Engage in a long or complex conversation with the Claude CLI, generating a large amount of text in the session history.

Exit the CLI session normally.

In a new terminal window, attempt to resume the previous conversation by running the command:

Generated bash
claude --resume

Observe the process crash.

Expected Behavior

The claude --resume command should successfully load the previous session and allow the user to continue the conversation, even if the history file is large. The tool should handle large history files gracefully, perhaps by loading only a recent portion of the history or by streaming the content to avoid memory spikes.

Actual Behavior

The CLI process aborts immediately. The terminal displays a FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory message followed by a native stack trace. The shell (zsh) reports the process was aborted.

Additional Context

The machine is an Apple M4, so the issue is specific to the Node.js process heap limit, not a system-wide memory shortage.

The following is the complete error output from the terminal:

Generated log
<--- Last few GCs --->

[12776:0x148008000] 2773099 ms: Mark-Compact 4356.4 (4389.4) -> 3917.3 (3951.2) MB, pooled: 235 MB, 18.75 / 0.00 ms (average mu = 0.998, current mu = 0.992) allocation failure; scavenge might not succeed
[12776:0x148008000] 2774421 ms: Mark-Compact 4162.0 (4195.6) -> 4162.0 (4195.4) MB, pooled: 235 MB, 17.92 / 0.00 ms (average mu = 0.997, current mu = 0.986) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

1: 0x104b53808 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
2: 0x104d299f8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, v8::OOMDetails const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
3: 0x104f53034 v8::internal::Heap::stack() [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
4: 0x104f51294 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
5: 0x104f46f28 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
6: 0x104f478f4 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
7: 0x104f1a34c v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString(int, v8::internal::AllocationType) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
8: 0x104f2b30c v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<unsigned char const>, unibrow::Utf8Variant, v8::internal::AllocationType) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
9: 0x104d478f4 v8::String::NewFromUtf8(v8::Isolate, char const, v8::NewStringType, int) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
10: 0x104b60c78 node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
11: 0x105976aac Builtins_CallApiCallbackOptimizedNoProfiling [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
12: 0x10bc35204
13: 0x10c297c58
14: 0x105974838 Builtins_InterpreterEntryTrampoline [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
15: 0x105a7f298 Builtins_PromiseFulfillReactionJob [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
16: 0x1059a1214 Builtins_RunMicrotasks [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
17: 0x1059723f0 Builtins_JSRunMicrotasksEntry [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
18: 0x104ea69e4 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
19: 0x104ea7284 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
20: 0x104ea73bc v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate, v8::internal::MicrotaskQueue) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
21: 0x104ed5de0 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
22: 0x104ed6684 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
23: 0x105976978 Builtins_CallApiCallbackGeneric [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
24: 0x10bac6c9c
25: 0x10597250c Builtins_JSEntryTrampoline [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
26: 0x1059721b0 Builtins_JSEntry [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
27: 0x104ea6a24 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
28: 0x104ea6384 v8::internal::Execution::Call(v8::internal::Isolate, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
29: 0x104d41498 v8::Function::Call(v8::Isolate, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
30: 0x104a55a80 node::InternalCallbackScope::Close() [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
31: 0x104a55cc4 node::InternalMakeCallback(node::Environment, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>, node::async_context, v8::Local<v8::Value>) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
32: 0x104a6b174 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
33: 0x104c80df0 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
34: 0x104c82588 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
35: 0x104d037d8 node::crypto::TLSWrap::ClearOut() [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
36: 0x104d0573c node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
37: 0x104c869c0 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
38: 0x104c87108 node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s, long, uv_buf_t const) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
39: 0x10595b424 uv__stream_io [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
40: 0x105963a3c uv__io_poll [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
41: 0x1059503b0 uv_run [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
42: 0x104a56508 node::SpinEventLoopInternal(node::Environment*) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
43: 0x104b9d1ac node::NodeMainInstance::Run() [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
44: 0x104b0f36c node::Start(int, char**) [/Users/{user}/.nvm/versions/node/v23.10.0/bin/node]
45: 0x183642b98 start [/usr/lib/dyld]
zsh: abort claude --resume
IGNORE_WHEN_COPYING_START
content_copy
download
Use code with caution.
Log
IGNORE_WHEN_COPYING_END

View original on GitHub ↗

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