Skip to content

[wrangler] fix: remove stale --experimental-vm-modules flag and prevent silent exits#14306

Open
matingathani wants to merge 3 commits into
cloudflare:mainfrom
matingathani:fix/node-v26-silent-exit
Open

[wrangler] fix: remove stale --experimental-vm-modules flag and prevent silent exits#14306
matingathani wants to merge 3 commits into
cloudflare:mainfrom
matingathani:fix/node-v26-silent-exit

Conversation

@matingathani

@matingathani matingathani commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #14296.

Two issues caused wrangler to silently exit with code 1 on Node.js v26 with no error message:

  1. bin/wrangler.js was passing --experimental-vm-modules to the child process. This flag was deprecated when vm.Module became stable in Node.js v22, and the compiled wrangler-dist/cli.js does not use VM Modules. On Node.js v26, the stale flag triggers unexpected behaviour.

  2. If handleError() itself throws (e.g. during config parsing before it can log the original error), the exception was silently swallowed by the top-level .catch() in cli.ts which just calls process.exit(exitCode) with no output. Wrapping handleError() in a try-catch ensures the user always sees the original error message on stderr.


  • Tests
    • Additional testing not necessary because: the --experimental-vm-modules removal is a no-op for Node.js < v26 (the flag was simply accepted and ignored), and the try-catch fallback only activates when handleError() itself throws which is an abnormal internal error path. Manual verification on Node.js v26 confirms the fix.
  • Public documentation
    • Documentation not necessary because: this is a bug fix restoring existing expected behaviour (wrangler should always print an error before exiting), not a behaviour or API change.

Open in Devin Review

Copilot AI review requested due to automatic review settings June 15, 2026 14:09
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f107c99

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This comment was marked as resolved.

@workers-devprod workers-devprod requested review from a team and penalosa and removed request for a team June 15, 2026 14:09
@workers-devprod

workers-devprod commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/fix-node-v26-silent-exit.md: [@cloudflare/wrangler]
  • packages/wrangler/AGENTS.md: [@cloudflare/wrangler]
  • packages/wrangler/bin/wrangler.js: [@cloudflare/wrangler]
  • packages/wrangler/src/index.ts: [@cloudflare/wrangler]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14306

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14306

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14306

miniflare

npm i https://pkg.pr.new/miniflare@14306

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14306

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14306

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14306

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14306

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14306

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14306

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14306

wrangler

npm i https://pkg.pr.new/wrangler@14306

commit: b439e13

matingathani added a commit to matingathani/workers-sdk that referenced this pull request Jun 16, 2026
- Remove fix: prefix from changeset title (Devin)
- Rewrite changeset body to focus on user-facing impact, not implementation details (Devin)
- Update AGENTS.md to remove stale --experimental-vm-modules reference (Devin)
- Capture handleError exception in catch block, include in stderr fallback (Copilot)
- Use e.stack ?? e.message for more informative fallback output (Copilot)

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

…t silent exits

Remove `--experimental-vm-modules` from the child process spawn args in
`bin/wrangler.js`. This flag was deprecated when `vm.Module` became stable
in Node.js v22, and `wrangler-dist/cli.js` makes zero use of VM Modules.
The stale flag causes unexpected behaviour on Node.js v26, where users see
wrangler silently exit with code 1 after printing the banner.

Also wrap the `handleError()` call in a try-catch so that if `handleError()`
itself throws, the original error message is written directly to stderr.
Previously, `handleError()` exceptions were silently swallowed by the
top-level `.catch()` in `cli.ts`, producing a silent exit with code 1.

Fixes cloudflare#14296
- Remove fix: prefix from changeset title (Devin)
- Rewrite changeset body to focus on user-facing impact, not implementation details (Devin)
- Update AGENTS.md to remove stale --experimental-vm-modules reference (Devin)
- Capture handleError exception in catch block, include in stderr fallback (Copilot)
- Use e.stack ?? e.message for more informative fallback output (Copilot)
@petebacondarwin petebacondarwin force-pushed the fix/node-v26-silent-exit branch from f107c99 to b439e13 Compare June 17, 2026 08:49

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

"wrangler": patch
---

Remove deprecated `--experimental-vm-modules` flag and prevent silent exit on unexpected errors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changeset title includes internal implementation detail (--experimental-vm-modules)

Per REVIEW.md: "Changesets should target users of the tools (e.g. Wrangler users) rather than maintainers. Avoid including implementation details like 'moves X from hybridModules to nativeModules' or 'removes polyfill implementation'." The changeset title "Remove deprecated --experimental-vm-modules flag and prevent silent exit on unexpected errors" mentions --experimental-vm-modules, an internal Node.js flag passed by the bin/wrangler.js shim that users never see or interact with. A more user-focused title would be something like "Fix silent exit with no error message on Node.js v26".

Suggested change
Remove deprecated `--experimental-vm-modules` flag and prevent silent exit on unexpected errors
Fix silent exit with no error message on Node.js v26
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@petebacondarwin

Copy link
Copy Markdown
Contributor

As far as I can tell vm.Module is still experimental and the --experimental-vm-modules flag is still required:

https://nodejs.org/docs/latest-v26.x/api/vm.html#class-vmmodule

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

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

wrangler deploy silently exits with code 1 on Node.js v26 after banner (no error message)

4 participants