ReferenceError: getCurrentOutputStyleName is not defined on session start/resume (regression in 2.1.193, still in 2.1.195)

Status Closed — not planned
Reported on v2.1.193
Maintainer reply None cached
Activity 7 comments · opened Jun 28, 2026 · closed Aug 18, 2026

Summary

Launching/resuming a session crashes with ReferenceError: getCurrentOutputStyleName is not defined. The function is called but never defined in the bundle. Introduced in 2.1.193 and still present in 2.1.195 (latest). 2.1.191 is unaffected.

Error

ERROR  getCurrentOutputStyleName is not defined
/$bunfs/root/src/entrypoints/cli.js:32559:7784
 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:32559:7784)
 - LT (.../cli.js:545:64488)
 - Sie (.../cli.js:545:77933)
 - NT (.../cli.js:545:77808)
 ... (repeated Sie/NT React render frames)

The stack is entirely minified React component render frames, so it fires during a UI render on startup/resume.

Root cause

The bundle contains exactly one code reference to the symbol, a free (un-minified) call with no corresponding definition:

... .agentDefinitions.activeAgents), account: <fn>(), outputStyle: getCurrentOutputStyleName(), mcpServers: ...

Because getCurrentOutputStyleName is left as an un-minified free identifier (no function getCurrentOutputStyleName / const getCurrentOutputStyleName = anywhere), it resolves to nothing at runtime → ReferenceError. This looks like a context/telemetry payload builder (collecting account, outputStyle, mcpServers) that lost its import/definition during bundling.

Evidence across builds (native installer)

Counting code-symbol occurrences in each cached binary:

| Version | getCurrentOutputStyleName refs | Status |
|---------|----------------------------------|--------|
| 2.1.191 | 0 | OK (symbol does not exist) |
| 2.1.193 | call present, no definition | crashes |
| 2.1.195 | call present, no definition | crashes |

So this is a 2.1.193 regression, not new in 2.1.195, and updating does not fix it (195 is latest published).

Repro

  1. Install/run Claude Code 2.1.193 or 2.1.195 (native installer).
  2. Start or resume a session (the render path that builds the context payload containing outputStyle).
  3. Crash with the error above.

Note: no outputStyle is configured in any settings.json, and no custom output styles exist — so it is not a user-config issue. It reproduces with default config.

Workaround

Roll the native-installer symlink back to a good build and pin it:

ln -sfn ~/.local/share/claude/versions/2.1.191 ~/.local/bin/claude
# add to ~/.claude/settings.json env: "DISABLE_AUTOUPDATER": "1"

Environment

  • Claude Code: 2.1.193 / 2.1.195 (broken), 2.1.191 (works)
  • Install: native installer (~/.local/share/claude/versions/...)
  • Platform: macOS (Darwin 25.5.0), arm64

Suggested fix

Restore the missing definition/import of getCurrentOutputStyleName (or guard the call) in the context/telemetry payload builder so the outputStyle field resolves safely.

View original on GitHub ↗

6 Comments

yurukusa · 2 months ago

Solid root-cause writeup — the free getCurrentOutputStyleName identifier with no definition in the telemetry/context-payload builder matches the all-React-render stack on startup. (I'm on 2.1.179 so I can't reproduce 2.1.193/195 myself; the notes below are the things I can verify, framed as such.)
Three things worth adding for anyone landing here in a panic, since "every session start crashes" reads like a total lockout:
1. Your sessions are not lost — this is purely the binary. The crash is in a render-path telemetry builder, not in storage. Your conversation history lives on disk as ~/.claude/projects/<encoded-cwd>/<uuid>.jsonl and is untouched by this bug (verified on my own install: the transcripts are plain .jsonl files that exist independently of the running version). So the rollback fully recovers you, and claude --resume brings the old sessions right back. Nothing was deleted.
2. Don't "fix" it by reinstalling from scratch. Because the only broken thing is the compiled binary, a clean reinstall / deleting ~/.claude / clearing config buys you nothing and risks losing your settings.json, MCP servers, and custom config for no reason. Roll the binary back, leave config alone.
3. Rollback gotchas (so the workaround doesn't silently no-op):

  • Before ln -sfn ... 2.1.191 ..., confirm that version is actually cached: ls ~/.local/share/claude/versions/. If 2.1.191 isn't in there, the symlink points at a non-existent path and you get a different breakage instead of a fix. Pick the newest good version that is present (anything ≤ 2.1.191 by their evidence).
  • The native-installer symlink + DISABLE_AUTOUPDATER=1 advice only applies to native-installer users. If you installed via npm (which claude resolves into a node .../bin/claude), the symlink trick doesn't apply — pin instead with npm install -g @anthropic-ai/claude-code@<last-good-version> and avoid @latest / claude update until a fixed build ships.
  • Set DISABLE_AUTOUPDATER (or pin the npm version) before the next launch, otherwise an auto-update can quietly put you back on the broken build.

Net: acute and total (no session starts), but non-destructive — history and config are safe, and the rollback is a clean recovery rather than a rebuild.

helping083 · 2 months ago

I have this issue also.

PawiX25 · 2 months ago

Confirming the same crash on Windows 11 (native installer), so this isn't macOS-specific.

  • Claude Code 2.1.195 (and 2.1.193) crash with ReferenceError: getCurrentOutputStyleName is not defined on claude --resume; 2.1.191 is fine.
  • Same evidence in the bundled binary: the symbol appears only as the call site outputStyle:getCurrentOutputStyleName() with no definition. Occurrence counts in the cached native builds: 2.1.191 → 0, 2.1.193 → 1 (call, no def), 2.1.195 → 1 (call, no def).
  • Path in my stack trace: B:/~BUN/root/src/entrypoints/cli.js.
  • Workaround confirmed working on Windows: roll ~/.local/bin/claude.exe back to the cached versions/2.1.191 build and set DISABLE_AUTOUPDATER=1.

Env: Windows 11 Pro (10.0.26200), x64, native installer.

zinoviosDev · 2 months ago

Confirmed on Linux (kernel 7.1.1-tigerlake, x86_64), Claude Code 2.1.195.

Same error, same stack trace as described.

Additional workaround (no downgrade needed): print mode bypasses the crashing render path entirely:

claude -p --resume <session-id> "your message"

Tested on a session originally created with 2.1.178–2.1.186 — resumes cleanly with -p, crashes with interactive mode.

zinoviosDev · 2 months ago

Confirmed still broken in 2.1.197 (Linux, x86_64, kernel 7.1.1-tigerlake)

Tested by triggering the native installer update from 2.1.195 → 2.1.197:

~/.local/share/claude/versions/2.1.195 update
# Successfully updated from 2.1.195 to version 2.1.197

Symbol occurrence count in each binary (grep -oa "getCurrentOutputStyleName" <binary> | wc -l):

| Version | Occurrences | Status |
|---------|-------------|--------|
| 2.1.190 | 0 | ✅ OK |
| 2.1.195 | 2 | ❌ crashes |
| 2.1.197 | 2 | ❌ crashes |

Context in 2.1.197 bundle (identical to 2.1.195):

activeAgents),account:INt(),outputStyle:getCurrentOutputStyleName(),mcpServers:...

Call site present, no definition — same root cause, not fixed in 2.1.197.

Workaround still required: pin to 2.1.190 or use claude -p (print mode).

zinoviosDev · 2 months ago

Binary patch workaround (works on Linux/macOS/Windows-WSL, no downgrade needed)

Since the bug persists in 2.1.197, here's a surgical binary patch that fixes it without rolling back.

Root cause (confirmed)

The Bun bundle embeds JS uncompressed. getCurrentOutputStyleName() appears as a 27-byte literal call with no definition. Pre-2.1.193 the field didn't exist, so returning undefined is semantically equivalent.

Patch

Replace the 27-byte call with (void 0) + 19 spaces (same byte count → no offset shift, valid JS):

#!/usr/bin/env python3
import sys, os

NEEDLE      = b'getCurrentOutputStyleName()'   # 27 bytes
REPLACEMENT = b'(void 0)                   '   # 27 bytes

binary  = sys.argv[1]  # e.g. ~/.local/share/claude/versions/2.1.197
patched = binary + '-patched'

data = bytearray(open(binary, 'rb').read())
pos  = data.find(NEEDLE)
assert pos != -1, "needle not found — bug may already be fixed"
data[pos:pos+len(NEEDLE)] = REPLACEMENT
open(patched, 'wb').write(data)
os.chmod(patched, 0o755)
print(f"Patched → {patched}  (offset {pos})")
python3 patch.py ~/.local/share/claude/versions/2.1.197
# Patched → ...2.1.197-patched  (offset 242501161)

Auto-patch wrapper (survives future updates, self-disables when fixed)

Put this in a directory that precedes ~/.local/bin in $PATH (e.g. ~/.claude/scripts/claude):

#!/bin/bash
# Workaround for bug #71980 — remove once fixed upstream
NEEDLE='getCurrentOutputStyleName()'
REPLACEMENT='(void 0)                   '   # 27 bytes — same length as NEEDLE

has_bug() {
    # Bug = call present AND no definition
    # When Anthropic fixes it, they add a definition (getCurrentOutputStyleName=...)
    # so the second grep returns true and has_bug returns false → wrapper becomes a no-op
    grep -qoa 'getCurrentOutputStyleName(' "$1" 2>/dev/null && \
    ! grep -qoa 'getCurrentOutputStyleName=' "$1" 2>/dev/null && \
    ! grep -qoa 'function getCurrentOutputStyleName' "$1" 2>/dev/null
}

INSTALLED="$(readlink -f ~/.local/bin/claude 2>/dev/null)"

if has_bug "$INSTALLED"; then
    PATCHED="${INSTALLED}-patched"
    if [[ ! -f "$PATCHED" ]]; then
        cp "$INSTALLED" "$PATCHED"
        python3 -c "
import sys
path,n,r=sys.argv[1],sys.argv[2].encode(),sys.argv[3].encode()
d=bytearray(open(path,'rb').read()); pos=d.find(n)
if pos!=-1: d[pos:pos+len(n)]=r; open(path,'wb').write(d)
print(f'[wrapper] patched bug #71980 at offset {pos}')
" "$PATCHED" "$NEEDLE" "$REPLACEMENT" >&2
        chmod +x "$PATCHED"
    fi
    exec "$PATCHED" "$@"
else
    exec "$INSTALLED" "$@"   # no bug (old version or upstream fix) — pass-through
fi

Detection logic:

| Case | call present | definition present | action |
|------|----|---|---|
| ≤ 2.1.190 (old) | ✗ | ✗ | exec direct |
| 2.1.193–2.1.197 (buggy) | ✓ | ✗ | patch |
| Future fixed version | ✓ | ✓ | exec direct — wrapper is a no-op |

The wrapper patches once per new binary version (result cached as <version>-patched). When Anthropic ships a fix that includes the definition, has_bug returns false and the wrapper transparently falls through — no manual cleanup needed.

Tested on Linux x86_64, kernel 7.1.1-tigerlake, Claude Code 2.1.197.

Showing cached comments. Read the full discussion on GitHub ↗