claude-code - 💡(How to fix) Fix v2.1.116 crashes on Linux x64 with Bun CommonJS module error (regression of #45541) [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51661Fetched 2026-04-22 07:56:17
View on GitHub
Comments
4
Participants
3
Timeline
11
Reactions
0
Timeline (top)
labeled ×5commented ×4closed ×1subscribed ×1

claude crashes immediately on startup in v2.1.116 with a Bun TypeError: Expected CommonJS module to have a function wrapper. Looks like a regression of #45541 (reported for v2.1.97, fixed in v2.1.100). That issue is closed+locked, so filing a new one per the bot's instruction.

Error Message

$ claude 6 | "use strict"; 7 | 8 | // 9 | if (entry.instantiate) 10 | return entry.instantiate; 11 | var instantiatePromise = (async () => { ^ TypeError: Expected CommonJS module to have a function wrapper. If you weren't messing around with Bun's internals, this is a bug in Bun

Bun v1.3.13 (Linux x64 baseline)

Root Cause

claude crashes immediately on startup in v2.1.116 with a Bun TypeError: Expected CommonJS module to have a function wrapper. Looks like a regression of #45541 (reported for v2.1.97, fixed in v2.1.100). That issue is closed+locked, so filing a new one per the bot's instruction.

Fix Action

Fix / Workaround

The in-process auto-updater means that any long-running claude session on a user's machine can silently flip the symlink to 2.1.116, bricking all new terminals. Even users who pin their env to DISABLE_AUTOUPDATER=1 after 2.1.116 lands will keep getting re-broken by their pre-existing sessions (which were started without that env var). The only safe workarounds on the user side are: kill every running claude process, manually re-pin the symlink each time it flips, or delete 2.1.116 from disk.

User-side workaround

Code Example

$ claude
 6 |     "use strict";
 7 |
 8 |     //
 9 |     if (entry.instantiate)
10 |         return entry.instantiate;
11 |     var instantiatePromise = (async () => {
                                               ^
TypeError: Expected CommonJS module to have a function wrapper. If you weren't messing around with Bun's internals, this is a bug in Bun

Bun v1.3.13 (Linux x64 baseline)

---

# Re-pin to the last working version
ls ~/.local/share/claude/versions/
ln -sfn ~/.local/share/claude/versions/2.1.114 ~/.local/bin/claude

# Set DISABLE_AUTOUPDATER=1 in your shell profile so *new* sessions don't flip it back.
# Caveat: pre-existing long-running claude sessions still have the old env and can
# re-flip the symlink on their own update timer — kill them, or keep re-pinning.
RAW_BUFFERClick to expand / collapse

Summary

claude crashes immediately on startup in v2.1.116 with a Bun TypeError: Expected CommonJS module to have a function wrapper. Looks like a regression of #45541 (reported for v2.1.97, fixed in v2.1.100). That issue is closed+locked, so filing a new one per the bot's instruction.

Error output (raw, as the user sees it)

$ claude
 6 |     "use strict";
 7 |
 8 |     //
 9 |     if (entry.instantiate)
10 |         return entry.instantiate;
11 |     var instantiatePromise = (async () => {
                                               ^
TypeError: Expected CommonJS module to have a function wrapper. If you weren't messing around with Bun's internals, this is a bug in Bun

Bun v1.3.13 (Linux x64 baseline)

Reproduction

  1. Be on the auto-update channel running a working 2.1.11x build.
  2. The in-process auto-updater (part of claude itself) fetches 2.1.116 into ~/.local/share/claude/versions/2.1.116 and flips the ~/.local/bin/claude symlink to it.
  3. Open a new terminal, run claude — crashes before printing any Claude Code output. Happens regardless of CWD, repo, or config.

100% reproducible on my machine.

Versions I have on disk

All installed via the native installer's auto-updater:

VersionWorks?
2.1.90
2.1.110
2.1.112
2.1.113
2.1.114
2.1.116❌ crashes as above

Rolling the ~/.local/bin/claude symlink back to 2.1.114 restores a working CLI, so this is isolated to the 2.1.116 build itself — not a user-config or environment issue.

Environment

  • OS: Ubuntu 22.04 (kernel 6.8.0-106-generic)
  • Arch: x86_64
  • CPU: 12th Gen Intel Core i7-1255U — has AVX2 and BMI2 (verified via /proc/cpuinfo). So the Linux x64 baseline label in the Bun error refers to the baseline Bun build shipped inside 2.1.116, not to a missing CPU feature on the host.
  • Install method: native installer (curl -fsSL https://claude.ai/install.sh | bash), binary at ~/.local/bin/claude~/.local/share/claude/versions/2.1.116 (ELF, Bun-compiled).
  • Shell: bash
  • No unusual env: node/npm not aliased to bun, $BUN_INSTALL not in PATH. The crashing Bun is the one embedded inside the Claude Code ELF itself.

Relationship to #45541

Same crash site, same Bun error message. #45541 was reported for 2.1.97 and confirmed fixed in 2.1.100. 2.1.110–2.1.114 were fine for me. Re-appears in 2.1.116 — suggesting the fix for #45541 regressed, or a new code path is tripping the same Bun CJS-wrapper issue.

Why the impact is larger than it looks

The in-process auto-updater means that any long-running claude session on a user's machine can silently flip the symlink to 2.1.116, bricking all new terminals. Even users who pin their env to DISABLE_AUTOUPDATER=1 after 2.1.116 lands will keep getting re-broken by their pre-existing sessions (which were started without that env var). The only safe workarounds on the user side are: kill every running claude process, manually re-pin the symlink each time it flips, or delete 2.1.116 from disk.

Suggested follow-ups

  • Yank 2.1.116 from the auto-update channel until a fixed build is available — everyone on the default baseline-Bun native-installer build gets their CLI broken with no warning, and the in-process updater propagates the break even to users who haven't explicitly updated.
  • Investigate whether the baseline-Bun build used for 2.1.116 was bumped (and hit a Bun regression), or whether new CJS-wrapped code re-triggers the #45541 path.
  • Consider adding a preflight ./binary --version smoke check in the updater before it commits the new symlink, so a build that can't even start its own process never replaces a working one.

User-side workaround

# Re-pin to the last working version
ls ~/.local/share/claude/versions/
ln -sfn ~/.local/share/claude/versions/2.1.114 ~/.local/bin/claude

# Set DISABLE_AUTOUPDATER=1 in your shell profile so *new* sessions don't flip it back.
# Caveat: pre-existing long-running claude sessions still have the old env and can
# re-flip the symlink on their own update timer — kill them, or keep re-pinning.

extent analysis

TL;DR

The most likely fix is to roll back to a working version of claude, such as 2.1.114, until a fixed build is available.

Guidance

  • Roll back to a working version of claude by re-pinning the symlink to a known good version, such as 2.1.114, using the provided bash commands.
  • Set DISABLE_AUTOUPDATER=1 in your shell profile to prevent new sessions from updating to the broken version.
  • Consider killing any long-running claude sessions to prevent them from re-flipping the symlink.
  • Investigate whether the baseline-Bun build used for 2.1.116 was bumped and hit a Bun regression, or whether new CJS-wrapped code re-triggers the #45541 path.

Example

The provided bash commands can be used to roll back to a working version:

ls ~/.local/share/claude/versions/
ln -sfn ~/.local/share/claude/versions/2.1.114 ~/.local/bin/claude

Notes

The issue seems to be related to a regression of #45541, which was previously fixed in 2.1.100. The problem is isolated to the 2.1.116 build itself and not a user-config or environment issue.

Recommendation

Apply the workaround by rolling back to a working version, such as 2.1.114, until a fixed build is available. This is because the issue is causing the claude CLI to crash immediately on startup, and rolling back to a known good version is the safest and most reliable solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix v2.1.116 crashes on Linux x64 with Bun CommonJS module error (regression of #45541) [4 comments, 3 participants]