[BUG] Claude Code crashes due to OOM
Environment
- Platform (select one):
- [ x ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ x ] Other: Claude Code
- Claude CLI version: 1.0.10 (Claude Code)
- Operating System: MacOS 15.5
- Terminal: iTerm2
Bug Description
I'm getting the following error when it's generating code
<--- Last few GCs --->
[2579:0x128008000] 973483 ms: Mark-Compact 3777.2 (4137.3) -> 3761.1 (4137.0) MB, 37.21 / 0.00 ms (average mu = 0.373, current mu = 0.366) allocation failure; scavenge might not succeed
[2579:0x128008000] 973545 ms: Mark-Compact 3777.5 (4137.5) -> 3761.7 (4137.8) MB, 39.21 / 0.00 ms (average mu = 0.372, current mu = 0.371) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x100bd20c4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
2: 0x100d4fdd4 v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
3: 0x100d4fd84 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
4: 0x100ee2e98 v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
5: 0x100ee58e4 v8::internal::Heap::ComputeMutatorUtilization(char const*, double, double) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
6: 0x100ee3b40 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
7: 0x100ee19c8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
8: 0x100ed9698 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
9: 0x100ed9e04 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
10: 0x100ec2d74 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
11: 0x1011d2bb4 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
12: 0x100a00c44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
13: 0x1088db104
14: 0x1086e7930
15: 0x100a23ee4 Builtins_ArrayMap [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
16: 0x1086e2550
17: 0x108811254
18: 0x108dd9054
19: 0x108a5d048
20: 0x108a8b85c
21: 0x108a9d17c
22: 0x108a20bb0
23: 0x108ce3700
24: 0x1009af210 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
25: 0x100a5cfb8 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
26: 0x10099eb94 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
27: 0x1009763f4 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
28: 0x100e6ec1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
29: 0x100e6f0ac v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
30: 0x100e905e0 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
31: 0x100e90414 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
32: 0x100da7e80 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
33: 0x100da79d8 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long, int) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
34: 0x100da77a0 v8::internal::Builtin_HandleApiCall(int, unsigned long, v8::internal::Isolate) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
35: 0x100a00b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
36: 0x10872dc88
37: 0x10097650c Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
38: 0x1009761f4 Builtins_JSEntry [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
39: 0x100e6ec44 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
40: 0x100e6e28c 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>) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
41: 0x100d652a0 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
42: 0x100af0cac node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
43: 0x100af112c node::InternalMakeCallback(node::Environment, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>, node::async_context) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
44: 0x100b06a50 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
45: 0x100caee04 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
46: 0x100caf1b0 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
47: 0x100d258bc node::crypto::TLSWrap::ClearOut() [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
48: 0x100d25d6c node::crypto::TLSWrap::Cycle() [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
49: 0x100d2437c node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
50: 0x100cb575c node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
51: 0x100cb53ec node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s, long, uv_buf_t const) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
52: 0x10389afc8 uv__stream_io [/opt/homebrew/Cellar/libuv/1.49.0/lib/libuv.1.dylib]
53: 0x1038a20d4 uv__io_poll [/opt/homebrew/Cellar/libuv/1.49.0/lib/libuv.1.dylib]
54: 0x1038920b0 uv_run [/opt/homebrew/Cellar/libuv/1.49.0/lib/libuv.1.dylib]
55: 0x100af19d0 node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
56: 0x100c16780 node::NodeMainInstance::Run(node::ExitCode, node::Environment) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
57: 0x100c16450 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
58: 0x100b95be4 node::Start(int, char**) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
59: 0x1809d6b98 start [/usr/lib/dyld]
17 Comments
This might be related: https://github.com/anthropics/claude-code/issues/1554
I think they tried improving the streaming support and jammed everything into memory and causes overflow - i downgraded to 1.0.9 and disabled auto update using the env variable. I think it's working? Although, it's painfully slow today for some reason (Opus model). 1.0.10 is def broken i think.
Also Claude trying to run bash commands on its own is extremely slow for some reason, and sometimes it doesn't know that command completed, resulting in 2m timeout although it was completed, so annoying. I'm on the 20X max plan
sry mate, but how did you downgrade? im trying to do the same, but no luck so far
@juggerke
npm install -g --force --prefer-online @anthropic-ai/claude-code@1.0.9I see this also frequently in 1.0.10 .. especially when writing new files
@dayowe thank you mate.
yeah, it also happens for me. its very interesting, that sometimes its crahes, i do claude --resume, then ask for the same prompt on the same file, and nails it perfectly.
same issue https://github.com/anthropics/claude-code/issues/1600
We believe this should be mitigated in the latest release, v1.0.15. Please update and give it a try.
Can anyone confirm if this works? Today I moved to @anthropic-ai/claude-code@1.0.9 and it worked.
works for me, the ctx per read i think has been reduced to 25000 but works better
@rboyce-ant seems resolved! Thanks for fixing this
@rboyce-ant I have v1.0.17 have this error (occur consistently with the same prompt). I downgrade to v1.0.15 and it worked (not have the OOM crash error anymore. although it still attempt many times to read the whole large dataset files and have error
Error: Cannot create a string longer than 0x1fffffe8 characterseven when I tell it to not read large files in the prompt).So apparently the later versions don't have the fixes included in v1.0.15
I also experience the same error in v1.0.22. It doesn't fail like this with older versions
Same issue on 1.0.22:
Interestingly, downgrading to 1.0.9 and then back to the latest seems to have fixed the issue for me (at least for now!)
still happening, I am continuously facing this issue while Claude tries to read the DB,
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal
----- Native stack trace -----
1: 00007FF619510B6B node::SetCppgcReference+18123
2: 00007FF619482619 node::OnFatalError+265
3: 00007FF619F02C13 v8::api_internal::ToLocalEmpty+83
4: 00007FF619474946 DSA_meth_get_flags+36294
5: 00007FF619EAFD0E v8::SharedValueConveyor::SharedValueConveyor+416270
6: 00007FF619EAF90A v8::SharedValueConveyor::SharedValueConveyor+415242
7: 00007FF619EAFBCF v8::SharedValueConveyor::SharedValueConveyor+415951
8: 00007FF619EAFA40 v8::SharedValueConveyor::SharedValueConveyor+415552
9: 00007FF619FAB0AE v8::PropertyDescriptor::writable+677838
10: 00007FF59A3A533E
----- JavaScript stack trace -----
Same in reading a large file
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal
----- Native stack trace -----
1: 0xe22fb7 node::OnFatalError(char const, char const) [claude]
2: 0x122ada6 v8::Utils::ReportApiFailure(char const, char const) [claude]
3: 0xf93bee [claude]
4: 0x71d0bbe0f6e2
----- JavaScript stack trace -----
1: readFileSync (node:fs:441:20)
2: readFileSync (file:///home/denis/.nvm/versions/node/v22.5.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:680:7518)
3: RYA (file:///home/denis/.nvm/versions/node/v22.5.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:750:7232)
4: call (file:///home/denis/.nvm/versions/node/v22.5.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:1508:6310)
5: FC8 (file:///home/denis/.nvm/versions/node/v22.5.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:2546:10151)
6: processTicksAndRejections (node:internal/process/task_queues:95:5)
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.