Skip to content

[BUG] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #952

Closed

Description

@aimatchfun

Environment

Ubuntu Voyager - 25.10

Bug Description

Image

Steps to Reproduce

I ran the folloowing prompt:
 usando o aws cli envie os arquivo em storage/app/private/loras/ para o s3 na raiz do bucket loras

Activity

  1. mikehearn commented on May 4, 2025

    @mikehearn

    As a workaround you could try using GraalNodeJS: https://www.graalvm.org/

    It's an alternative to Node that runs on the JVM. Claude Code will start up slower, but will be able to handle bigger heaps than Node can.

  2. pj4533 commented on May 17, 2025

    @pj4533

    just came here to say I get this doing some file renaming tasks. I use Claude Code a ton for coding, no problems, but tried to rename a bunch of files and get this error every time.

    Happy to provide logging or whatever if it would help!

  3. pj4533 commented on May 18, 2025

    @pj4533

    Here is the stack trace I get:

    <--- Last few GCs --->
    
    [2289:0x150030000]    51034 ms: Mark-Compact 3960.4 (3994.1) -> 3960.4 (3994.1) MB, pooled: 14 MB, 8.42 / 0.00 ms  (average mu = 1.000, current mu = 0.999) allocation failure; scavenge might not succeed
    [2289:0x150030000]    54591 ms: Mark-Compact 4400.0 (4433.4) -> 4395.0 (4432.5) MB, pooled: 15 MB, 10.58 / 0.00 ms  (average mu = 0.999, current mu = 0.997) allocation failure; scavenge might not succeed
    
    
    <--- JS stacktrace --->
    
    FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
    ----- Native stack trace -----
    
     1: 0x10486f7c0 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     2: 0x104a193f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     3: 0x104bd6424 v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     4: 0x104bd3a80 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     5: 0x104bcd0a4 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     6: 0x104bcda6c v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     7: 0x104bb9d44 v8::internal::MaybeHandle<v8::internal::SeqTwoByteString> v8::internal::FactoryBase<v8::internal::Factory>::NewRawStringWithMap<v8::internal::SeqTwoByteString>(int, v8::internal::Tagged<v8::internal::Map>, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     8: 0x104bbf420 v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<unsigned char const>, unibrow::Utf8Variant, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
     9: 0x104a3854c v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    10: 0x10487e620 node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    11: 0x1045ce978 Builtins_CallApiCallbackGeneric [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    12: 0x10cf09a64
    13: 0x10ced56f4
    14: 0x10d1b9614
    15: 0x1045cc838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    16: 0x1046d7298 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    17: 0x1045f9214 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    18: 0x1045ca3f0 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    19: 0x104b4b31c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    20: 0x104b4ba88 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    21: 0x104b7603c v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    22: 0x1045ceaac Builtins_CallApiCallbackOptimizedNoProfiling [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    23: 0x10d1d5464
    24: 0x1045ca50c Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    25: 0x1045ca1b0 Builtins_JSEntry [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    26: 0x104b4b344 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    27: 0x104b4acac 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/23.9.0/bin/node]
    28: 0x104a2ff34 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    29: 0x1047856d4 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    30: 0x104785b94 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/23.9.0/bin/node]
    31: 0x10479dd90 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    32: 0x1049876b4 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    33: 0x104987938 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    34: 0x1049fec00 node::crypto::TLSWrap::ClearOut() [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    35: 0x1049ff0ac node::crypto::TLSWrap::Cycle() [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    36: 0x1049fd6dc node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    37: 0x10498dd20 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    38: 0x10498da28 node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s*, long, uv_buf_t const*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    39: 0x107fc6e6c uv__stream_io [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
    40: 0x107fce0e0 uv__io_poll [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
    41: 0x107fbdf08 uv_run [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
    42: 0x104786488 node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    43: 0x1048b6f10 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    44: 0x1048b6c64 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    45: 0x10483027c node::Start(int, char**) [/opt/homebrew/Cellar/node/23.9.0/bin/node]
    
  4. ulshv commented on Jun 4, 2025

    @ulshv

    Claude Code has a memory leak or an infinite loop - the corresponding node process just fills up the whole heap (be it 8GB or more) when saving the file and then crashes with the error OP posted.

    I've tried: node --max-old-space-size=8192 $(which claude), but it didn't help.

  5. ulshv commented on Jun 4, 2025

    @ulshv

    Temporary fix:

    npm i -g @anthropic-ai/claude-code@1.0.9
    claude config set -g autoUpdaterStatus disabled
  6. github-actions commented on Oct 10, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  7. github-actions commented on Oct 17, 2025

    @github-actions

    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.

  8. locked as resolved and limited conversation to collaborators on Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions