Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
RangeError: Maximum call stack size exceeded in ESM module loader on large single-file bundled ESM output | GoodFirstPicks

RangeError: Maximum call stack size exceeded in ESM module loader on large single-file bundled ESM output

nodejs/node 1 comments 4d ago
View on GitHub
highopenScope: somewhat clearSkill match: maybeNode.jsJavaScript

Why this is a good first issue

The issue involves deep ESM loader internals and cyclic dependencies.

AI Summary

The ESM module loader in Node.js 22.x crashes with a stack overflow when loading a large single-file bundled ESM package with cyclic re-exports. The fix likely requires understanding and modifying the ESM loader's handling of cyclic dependencies. The issue is reproducible but involves complex module loading internals.

Issue Description

Version

Node version: v22.22.1

Platform

Linux x86_64 (Linux 5.15.0-100-generic)

Subsystem

ESM module loader / node:internal/modules/esm/utils compileSourceTextModule

What steps will reproduce the bug?

  1. Install openclaw from npm: npm install -g openclaw
  2. Try to run the gateway: openclaw gateway start
  3. The process immediately crashes with RangeError: Maximum call stack size exceeded

Package: https://www.npmjs.com/package/openclaw

How often does it reproduce? Is there a required condition?

100% reproducible on every startup with Node.js 22.22.1.

Required conditions:

  • Node.js 22.x (tested on 22.22.1)
  • Loading a large single-file bundled ESM package that contains many cyclic re-exports (common output from modern bundlers like esbuild/rollup)

What is the expected behavior? Why is that the expected behavior?

Expected: Node.js should successfully load the module and start the application.

This is the expected behavior because:

  • The same code/package works correctly on Node.js 20.x
  • Single-file ESM bundling is a common distribution method for CLI tools on npm
  • Cyclic dependencies/re-exports should be handled gracefully by the module loader without infinite recursion

What do you see instead?

The ESM module loader goes into infinite recursion during loading and eventually crashes with:

RangeError: Maximum call stack size exceeded at compileSourceTextModule (node:internal/modules/esm/utils:346:16) at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18) at #translate (node:internal/modules/esm/loader:546:20) at afterLoad (node:internal/modules/esm/loader:596:29) at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:601:12) at #createModuleJob (node:internal/modules/esm/loader:624:36) at #getJobFromResolveResult (node:internal/modules/esm/loader:343:41) at ModuleLoader.getModuleJobForImport (node:internal/m

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 35 points when you complete it!

Risk Flags

  • deep ESM loader knowledge required
  • potential cross-cutting changes
Loading labels...

Details

Points35 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno