[BUG] Claude Code: Crash: JavaScript heap out of memory
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ x] Other: Claude Code
- Claude CLI version: 1.0.95 (Claude Code)
- Operating System: MacOS 15.6.1
- Terminal: Terminal App
Bug Description
Crash during normal operation.
Steps to Reproduce
- Interact with the assistant
- Message lengths and formatting vary
- Several hours or days later, while operating with the assistant, assistant crashes
Expected Behavior
Claude Code continues to operate without interruption. A crash drops context and wastes time and resources.
Actual Behavior
Crashes and dumps error and stacktrace.
Additional Context
<--- Last few GCs --->
[57839:0x128018000] 189812216 ms: Scavenge (interleaved) 3814.7 (4104.7) -> 3806.7 (4104.7) MB, pooled: 2 MB, 1.12 / 0.00 ms (average mu = 0.224, current mu = 0.204) allocation failure;
[57839:0x128018000] 189812678 ms: Mark-Compact 3815.1 (4105.2) -> 3807.1 (4097.0) MB, pooled: 10 MB, 458.17 / 0.00 ms (average mu = 0.209, current mu = 0.194) allocation failure; scavenge might not succeed
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x102f1a164 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
2: 0x10304ba5c v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
3: 0x10304ba14 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
4: 0x103228618 v8::internal::Heap::stack() [/opt/homebrew/Cellar/node/24.4.1/bin/node]
5: 0x10322ad58 v8::internal::Heap::OldGenerationConsumedBytes() const [/opt/homebrew/Cellar/node/24.4.1/bin/node]
6: 0x10322abf8 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector, v8::base::TimeTicks) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
7: 0x103238584 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1::operator()() const [/opt/homebrew/Cellar/node/24.4.1/bin/node]
8: 0x103238228 void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1>(heap::base::Stack, void, void const*) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
9: 0x103980820 PushAllRegistersAndIterateStack [/opt/homebrew/Cellar/node/24.4.1/bin/node]
10: 0x103226bd8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
11: 0x10321e7e0 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
12: 0x1031f6bc0 v8::internal::MaybeHandle<v8::internal::SeqOneByteString> v8::internal::FactoryBase<v8::internal::Factory>::NewRawStringWithMap<v8::internal::SeqOneByteString>(int, v8::internal::Tagged<v8::internal::Map>, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
13: 0x1031f6a64 v8::internal::FactoryBase<v8::internal::Factory>::NewStringFromOneByte(v8::base::Vector<unsigned char const>, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
14: 0x10331e9d4 v8::internal::JsonStringifier::Stringify(v8::internal::Handle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver>>, v8::internal::Handle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver>>, v8::internal::Handle<v8::internal::Object>) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
15: 0x10332233c v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver>>, v8::internal::Handle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver>>, v8::internal::Handle<v8::internal::Object>) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
16: 0x1030ae3d0 v8::internal::Builtin_JsonStringify(int, unsigned long, v8::internal::Isolate) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
17: 0x103a41e94 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/opt/homebrew/Cellar/node/24.4.1/bin/node]
18: 0x138bbee24
19: 0x103a71a20 Builtins_ArrayMap [/opt/homebrew/Cellar/node/24.4.1/bin/node]
20: 0x1039a56e0 Builtins_InterpreterEnterAtBytecode [/opt/homebrew/Cellar/node/24.4.1/bin/node]
21: 0x138d00cb0
22: 0x1384a055c
23: 0x138dc953c
24: 0x1384b3950
25: 0x138cbd4bc
26: 0x138f2011c
27: 0x138cbf3f8
28: 0x138ca4900
29: 0x138f1fb64
30: 0x13899dc88
31: 0x138c982e4
32: 0x1039a28cc Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/24.4.1/bin/node]
33: 0x1039a2570 Builtins_JSEntry [/opt/homebrew/Cellar/node/24.4.1/bin/node]
34: 0x1031808a4 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
35: 0x103180294 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>, v8::base::Vector<v8::internal::DirectHandle<v8::internal::Object> const>) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
36: 0x10305cf48 v8::Function::Call(v8::Isolate, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
37: 0x102e68970 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/24.4.1/bin/node]
38: 0x102e68bb0 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>) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
39: 0x102e77928 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
40: 0x102fd4228 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
41: 0x102fd57d8 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
42: 0x102fd7f9c node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
43: 0x102fd8458 node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s, long, uv_buf_t const) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
44: 0x1083c3af0 uv__stream_io [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib]
45: 0x1083caca8 uv__io_poll [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib]
46: 0x1083bab58 uv_run [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib]
47: 0x102e693ec node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
48: 0x102f43f38 node::NodeMainInstance::Run(node::ExitCode, node::Environment) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
49: 0x102f43ccc node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/24.4.1/bin/node]
50: 0x102eef808 node::Start(int, char**) [/opt/homebrew/Cellar/node/24.4.1/bin/node]
51: 0x18adb2b98 start [/usr/lib/dyld]
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗