Skip to content

Fix: RangeError: Maximum call stack size exceeded - #260

Open
pikil wants to merge 1 commit into
isaacs:mainfrom
pikil:max-call-stack-exceeded
Open

pikil wants to merge 1 commit into
isaacs:mainfrom
pikil:max-call-stack-exceeded

Conversation

@pikil

@pikil pikil commented Mar 2, 2026

Copy link
Copy Markdown

When building a large project with Vite and including graceful-fs to avoid EMFILE error, the anchor crawlers might start to open too many files. This might potentially lead to the following error:

/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:371
function enqueue (elem) {
                 ^

RangeError: Maximum call stack size exceeded
    at enqueue (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:371:18)
    at /Users/jake/project/node_modules/graceful-fs/graceful-fs.js:359:11
    at retry (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:423:10)
    at enqueue (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:374:3)
    at /Users/jake/project/node_modules/graceful-fs/graceful-fs.js:359:11
    at retry (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:423:10)
    at enqueue (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:374:3)
    at /Users/jake/project/node_modules/graceful-fs/graceful-fs.js:359:11
    at retry (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:423:10)
    at enqueue (/Users/jake/project/node_modules/graceful-fs/graceful-fs.js:374:3)

Node.js v25.6.1

To avoid this, we can deprioritise retry method in the stack, so it is not being called until all current macrotasks are executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant