René's URL Explorer Experiment


Title: v26: top-level `await import()` of an evaluating-async module resolves before the module runs (TDZ ReferenceError) · Issue #66806 · nodejs/node · GitHub

Open Graph Title: v26: top-level `await import()` of an evaluating-async module resolves before the module runs (TDZ ReferenceError) · Issue #66806 · nodejs/node

X Title: v26: top-level `await import()` of an evaluating-async module resolves before the module runs (TDZ ReferenceError) · Issue #66806 · nodejs/node

Description: Version v26.12.0 (V8 14.6.202.34-node.39). It works in v24.22.0 (V8 13.6) and v25.9.0 (V8 14.1.146.11). Deno 2.9.7 (V8 15.0.245.2) fails the same way, so the bug looks like it is in V8. Platform Linux 6.8.0-147-generic x86_64 GNU/Linux S...

Open Graph Description: Version v26.12.0 (V8 14.6.202.34-node.39). It works in v24.22.0 (V8 13.6) and v25.9.0 (V8 14.1.146.11). Deno 2.9.7 (V8 15.0.245.2) fails the same way, so the bug looks like it is in V8. Platform Li...

X Description: Version v26.12.0 (V8 14.6.202.34-node.39). It works in v24.22.0 (V8 13.6) and v25.9.0 (V8 14.1.146.11). Deno 2.9.7 (V8 15.0.245.2) fails the same way, so the bug looks like it is in V8. Platform Li...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"v26: top-level `await import()` of an evaluating-async module resolves before the module runs (TDZ ReferenceError)","articleBody":"### Version\n\nv26.12.0 (V8 14.6.202.34-node.39). It works in v24.22.0 (V8 13.6) and v25.9.0 (V8 14.1.146.11). Deno 2.9.7 (V8 15.0.245.2) fails the same way, so the bug looks like it is in V8.\n\n### Platform\n\n```text\nLinux 6.8.0-147-generic x86_64 GNU/Linux\n```\n\n### Subsystem\n\nesm / V8 module evaluation (top-level await + dynamic `import()`)\n\n### What steps will reproduce the bug?\n\n```sh\nmkdir tla-tdz && cd tla-tdz\ncat > main.mjs \u003c\u003c'JS'\nimport { a } from './a.mjs';\nimport { x } from './b.mjs';\nconsole.log('ok', a(), x);\nJS\ncat > a.mjs \u003c\u003c'JS'\nawait import('./d.mjs');\nconst { x } = await import('./b.mjs'); // b is evaluating-async here\nexport const a = () => x;\nJS\ncat > b.mjs \u003c\u003c'JS'\nimport { c } from './c.mjs';\nexport const x = c + 1;\nJS\ncat > c.mjs \u003c\u003c'JS'\nawait new Promise(resolve => setTimeout(resolve, 10));\nexport const c = 1;\nJS\necho 'export const d = 0;' > d.mjs\nnode main.mjs\n```\n\nHere is what happens. `main` evaluates `a` first. `a` suspends on its first `await import()`, so `main` goes on to evaluate `b`. `b` depends on `c`, and `c` has a top-level `await`, so `b` becomes *evaluating-async*. Then `a` resumes and runs `await import('./b.mjs')` while `b` has not executed yet.\n\n### How often does it reproduce? Is there a required condition?\n\nIt fails every time. It needs a top-level `await import()` of a module that another branch of the same graph has already started evaluating, so that the module is *evaluating-async*. The module also must not be the cycle root of a capability that already exists.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```text\nok 2 2\n```\n\nNode 24.22.0, Node 25.9.0 and Bun 1.4.3 all print this. In ECMA-262 [Evaluate()](https://tc39.es/ecma262/#sec-moduleevaluation), `b` is *evaluating-async*, so `module` is set to `b.[[CycleRoot]]`, which is `b`. Its `[[TopLevelCapability]]` is empty, so a new capability is created. `InnerModuleEvaluation` then returns immediately, and because the status is not *evaluated* the promise is left pending. The promise is resolved only by [AsyncModuleExecutionFulfilled](https://tc39.es/ecma262/#sec-async-module-execution-fulfilled) or its `GatherAvailableAncestors` loop, after `b` has executed. `ContinueDynamicImport` resolves `import()` with the namespace only once that promise fulfils.\n\n### What do you see instead?\n\n```text\nfile:///…/a.mjs:2\nconst { x } = await import('./b.mjs'); // b is evaluating-async here\n        ^\n\nReferenceError: Cannot access 'x' before initialization\n    at file:///…/a.mjs:2:9\n\nNode.js v26.12.0\n```\n\nThe `import()` promise resolves with the namespace of a module whose body has not run yet.\n\n### Additional information\n\nWe hit this in a real application: [link-assistant/hive-mind#3469](https://github.com/link-assistant/hive-mind/issues/3469). 43 top-level `await import()` calls in its `src/` threw TDZ errors once a host moved to Node 26, while CI on Node 24 stayed green. The reproduction is also in [`experiments/node26-tla-tdz`](https://github.com/link-assistant/hive-mind/tree/issue-3469-80e8383bb928/experiments/node26-tla-tdz).\n\n**Workaround:** replace the top-level `await import('./b.mjs')` with a static `import * as b from './b.mjs'`. A static import is part of the graph, so it is evaluated before the importer's body on every runtime.\n\n**Suggested fix:** in V8's `SourceTextModule::Evaluate` / `Module::Evaluate` path, when the module (or its cycle root) is *evaluating-async* and has no top-level capability yet, store a new capability on the cycle root and leave it pending until async evaluation fulfils, as the spec does. Do not resolve it right away. A regression test would be the five files above, expecting `ok 2 2`. The behaviour changed between V8 14.1 and 14.6. One candidate is the module-evaluation refactoring for `import defer`, but I have not bisected it.\n","author":{"url":"https://github.com/konard","@type":"Person","name":"konard"},"datePublished":"2026-10-17T12:11:43Z","url":"https://github.com/nodejs/node/issues/66806"}

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:6b004bc8-7959-8360-ccf7-f7d765bc282a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA1A8:321644:A6085:E140D:6AED336D
html-safe-nonce730edfcbee69547dfc5f82b7e4ce9f51d476fc94c48be938402555009c8835f5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUE4OjMyMTY0NDpBNjA4NTpFMTQwRDo2QUVEMzM2RCIsInZpc2l0b3JfaWQiOiI5MDAzNDI0MTM5MTk1NTI4MDQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5ceed8757e98fc62aeb6de23f0347e95f12d581741fdc05355bc10f0fc1f237b
hovercard-subject-tagissue:5898193270
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/66806/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9cd3c00132bcb9786ac5e1e94947f450ed95f5d5c9bdf88f4e2e07000351c05a/nodejs/node/issues/66806
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9cd3c00132bcb9786ac5e1e94947f450ed95f5d5c9bdf88f4e2e07000351c05a/nodejs/node/issues/66806
og:image:altVersion v26.12.0 (V8 14.6.202.34-node.39). It works in v24.22.0 (V8 13.6) and v25.9.0 (V8 14.1.146.11). Deno 2.9.7 (V8 15.0.245.2) fails the same way, so the bug looks like it is in V8. Platform Li...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekonard
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
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
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/66806#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66806
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%2F66806
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/66806
Reloadhttps://github.com/nodejs/node/issues/66806
Reloadhttps://github.com/nodejs/node/issues/66806
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests665 (665)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/66806
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66806
#66810https://github.com/nodejs/node/pull/66810
v26: top-level await import() of an evaluating-async module resolves before the module runs (TDZ ReferenceError)https://github.com/nodejs/node/issues/66806#top
#66810https://github.com/nodejs/node/pull/66810
https://github.com/konard
konardhttps://github.com/konard
on Oct 17, 2026https://github.com/nodejs/node/issues/66806#issue-5898193270
Evaluate()https://tc39.es/ecma262/#sec-moduleevaluation
AsyncModuleExecutionFulfilledhttps://tc39.es/ecma262/#sec-async-module-execution-fulfilled
link-assistant/hive-mind#3469https://github.com/link-assistant/hive-mind/issues/3469
experiments/node26-tla-tdzhttps://github.com/link-assistant/hive-mind/tree/issue-3469-80e8383bb928/experiments/node26-tla-tdz
https://github.com/avivkeller
avivkellerhttps://github.com/avivkeller
on Oct 17, 2026https://github.com/nodejs/node/issues/66806#issuecomment-6240795626
@GeoffreyBoothhttps://github.com/GeoffreyBooth
#62530https://github.com/nodejs/node/pull/62530
c89ec29https://github.com/nodejs/node/commit/c89ec290f0f82f544e39e6e5f2eab3b6de2c1cca
https://github.com/GeoffreyBooth
GeoffreyBoothhttps://github.com/GeoffreyBooth
on Oct 18, 2026https://github.com/nodejs/node/issues/66806#issuecomment-6253908436
@GeoffreyBoothhttps://github.com/GeoffreyBooth
#62530https://github.com/nodejs/node/pull/62530
c89ec29https://github.com/nodejs/node/commit/c89ec290f0f82f544e39e6e5f2eab3b6de2c1cca
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/66806
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66806
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.