René's URL Explorer Experiment


Title: require(esm) inside a module.register() hook module fails with ERR_INTERNAL_ASSERTION in 26.12.0 · Issue #66767 · nodejs/node · GitHub

Open Graph Title: require(esm) inside a module.register() hook module fails with ERR_INTERNAL_ASSERTION in 26.12.0 · Issue #66767 · nodejs/node

X Title: require(esm) inside a module.register() hook module fails with ERR_INTERNAL_ASSERTION in 26.12.0 · Issue #66767 · nodejs/node

Description: Version v26.12.0 (works on v26.11.1 and v26.10.0) Platform Linux x64 Subsystem esm, module What steps will reproduce the bug? // repro.mjs import { mkdtempSync, writeFileSync } from 'node:fs' import { register } from 'node:module' import...

Open Graph Description: Version v26.12.0 (works on v26.11.1 and v26.10.0) Platform Linux x64 Subsystem esm, module What steps will reproduce the bug? // repro.mjs import { mkdtempSync, writeFileSync } from 'node:fs' impor...

X Description: Version v26.12.0 (works on v26.11.1 and v26.10.0) Platform Linux x64 Subsystem esm, module What steps will reproduce the bug? // repro.mjs import { mkdtempSync, writeFileSync } from 'node:fs...

Opengraph URL: https://github.com/nodejs/node/issues/66767

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"require(esm) inside a module.register() hook module fails with ERR_INTERNAL_ASSERTION in 26.12.0","articleBody":"### Version\n\nv26.12.0 (works on v26.11.1 and v26.10.0)\n\n### Platform\n\n```text\nLinux x64\n```\n\n### Subsystem\n\nesm, module\n\n### What steps will reproduce the bug?\n\n```js\n// repro.mjs\nimport { mkdtempSync, writeFileSync } from 'node:fs'\nimport { register } from 'node:module'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\n\n// Any ES module with at least one import (one without imports works)\nconst esm = join(mkdtempSync(join(tmpdir(), 'require-esm-')), 'esm.mjs')\nwriteFileSync(esm, \"import 'node:fs'\\n\")\n\n// The hook module defines no hooks: loading it in the hooks thread is enough\nconst hooks = `\nimport { createRequire } from 'node:module'\ncreateRequire(${JSON.stringify(esm)})(${JSON.stringify(esm)})\n`\n\nregister('data:text/javascript,' + encodeURIComponent(hooks))\nconsole.log('ok')\n```\n\n```sh\nnode repro.mjs\n```\n\n\n\n### How often does it reproduce? Is there a required condition?\n\nAlways. Required conditions:\n\n- The `require()` happens while loading a `module.register()` hook module (the hooks thread).\n- The required ES module has at least one import. With `export {}` instead, it prints `ok`.\n\nNo hooks need to be exported: the hook module defines none.\n\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`ok` is printed, as on v26.11.1 and v26.10.0 (which only print the `module.register()`\ndeprecation warning).\n\n\n### What do you see instead?\n\n\n```\nError [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\nPlease open an issue with this stack trace at https://github.com/nodejs/node/issues\n\n    at assert (node:internal/assert:11:11)\n    at ModuleJobSync.syncLink (node:internal/modules/esm/module_job:330:9)\n    at ModuleJobSync.link (node:internal/modules/esm/module_job:626:17)\n    at new ModuleJobSync (node:internal/modules/esm/module_job:616:26)\n    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:352:11)\n    at loadESMFromCJS (node:internal/modules/cjs/loader:1786:24)\n    at Module._compile (node:internal/modules/cjs/loader:1950:5)\n    at Object..js (node:internal/modules/cjs/loader:2108:10)\n    at Module.load (node:internal/modules/cjs/loader:1690:32)\n    at Module._load (node:internal/modules/cjs/loader:1480:12) {\n  code: 'ERR_INTERNAL_ASSERTION'\n}\n```\n\nThe failing assertion is `assert(!isPromise(job))` in `ModuleJobSync.syncLink()`: inside the\nhooks thread, `getOrCreateModuleJob()` returns a promise for the required module's dependency\nwhile the module is being linked synchronously for `require()`.\n\n\n### Additional information\n\nBisected between releases only: v26.11.1 works, v26.12.0 fails. v26.12.0 includes\n\"module: synchronously load most ES modules\" (#62530), which changed this code path; that PR is\nthe likely cause but the exact commit was not bisected.\n","author":{"url":"https://github.com/ivan-tymoshenko","@type":"Person","name":"ivan-tymoshenko"},"datePublished":"2026-10-15T15:15:51Z","url":"https://github.com/nodejs/node/issues/66767"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:16a2e7a1-5ad0-6748-e721-a7cdbc060eaa
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9096:1F5F5F:8409D3:AF712F:6AED27F7
html-safe-noncec99c1d12d3c2cadb7539ec9e2f9d41fefad7d3b59b0a08108093df75e767e38f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDk2OjFGNUY1Rjo4NDA5RDM6QUY3MTJGOjZBRUQyN0Y3IiwidmlzaXRvcl9pZCI6IjU2NzgxNDY1NTE4MDQ2Njc4OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8acc6d027656f333be84b27752a043395526dbb69d96bf7f0ca2d233f29049be
hovercard-subject-tagissue:5868823886
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66767/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ca53c7409600eea8c92393c15f259620090392b144e8f894a449d292f153040a/nodejs/node/issues/66767
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ca53c7409600eea8c92393c15f259620090392b144e8f894a449d292f153040a/nodejs/node/issues/66767
og:image:altVersion v26.12.0 (works on v26.11.1 and v26.10.0) Platform Linux x64 Subsystem esm, module What steps will reproduce the bug? // repro.mjs import { mkdtempSync, writeFileSync } from 'node:fs' impor...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameivan-tymoshenko
hostnamegithub.com
expected-hostnamegithub.com
None9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release98b41fa4b5635ceb45a4c54320fced73817ff290
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/66767#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66767
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66767
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/66767
Reloadhttps://github.com/nodejs/node/issues/66767
Reloadhttps://github.com/nodejs/node/issues/66767
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues657 (657)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66767
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66767
#66770https://github.com/nodejs/node/pull/66770
require(esm) inside a module.register() hook module fails with ERR_INTERNAL_ASSERTION in 26.12.0https://github.com/nodejs/node/issues/66767#top
#66770https://github.com/nodejs/node/pull/66770
https://github.com/ivan-tymoshenko
ivan-tymoshenkohttps://github.com/ivan-tymoshenko
on Oct 15, 2026https://github.com/nodejs/node/issues/66767#issue-5868823886
#62530https://github.com/nodejs/node/pull/62530
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#66770https://github.com/nodejs/node/pull/66770
on Oct 17, 2026https://github.com/nodejs/node/issues/66767#event-33529317616
nodejs-github-bothttps://github.com/nodejs-github-bot
on Oct 17, 2026https://github.com/nodejs/node/issues/66767#event-33529317738
module: fix require(esm) on the module.register() hooks threadhttps://github.com/nodejs/node/commit/c526694ae90cfca7439a41ba5822c0dcc64a7e7d
c526694https://github.com/nodejs/node/commit/c526694ae90cfca7439a41ba5822c0dcc64a7e7d
Xmaderhttps://github.com/Xmader
on Oct 23, 2026https://github.com/nodejs/node/issues/66767#event-34092335570
Revert "module: synchronously load most ES modules"https://github.com/Distributive-Network/node/commit/e5cae10148877474eb2ba6a02136e90284eb321f
e5cae10https://github.com/Distributive-Network/node/commit/e5cae10148877474eb2ba6a02136e90284eb321f
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/66767
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66767
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.