Fix Claude Code Terminal Display Corruption: Garbled Characters, Gibberish Text, and Unreadable Output in macOS Terminal, VS Code, and JupyterLab (v2.1.142–v2.1.145+)
Starting around Claude Code v2.1.142 (May 2026), the terminal display becomes progressively corrupted during sessions — all output renders as garbled symbols, random characters, and unreadable text instead of clean English/ASCII. This affects: (1) shell prompts and user input appearing as random symbols, (2) all Claude Code assistant responses, system messages, and status updates rendering as gibberish, (3) table/box-drawing characters showing corrupted line-drawing symbols instead of clean ASCII borders, (4) the corruption persisting across the entire session from start to finish with no readable sections, and (5) getting progressively worse with continued usage until the terminal is almost completely unusable. Anthropic staff (bcherny) acknowledged the issue and diana-ant reported it fixed in v2.1.144 (May 18, 2026), but multiple users confirmed the corruption persists in v2.1.144 and v2.1.145 in VS Code integrated terminal and JupyterLab terminal on macOS. The corruption may be correlated with the /goal command introduced in v2.1.142. Workarounds include: resizing the terminal window, toggling full-screen mode, using /save and /resume to restore readability, or downgrading to v2.1.141 (last known-good version before /goal was introduced).
Symptoms
- All Claude Code terminal output appears as garbled random symbols and unreadable characters instead of readable English text — text that should say 'Let me analyze the code' appears as 'L╔t m╔ ░n░lyz╔ th╔ c╞d╔' with box-drawing artifacts
- Shell prompts and user input display as random symbols — the user cannot read what they typed. The prompt '~/projects/myapp $' appears as corrupted line-drawing characters with mixed symbol substitution
- ASCII table borders and box-drawing characters (│, ─, ┌, ┐, └, ┘, ├, ┤) appear as corrupted line-drawing symbols instead of clean borders — git diff stats and file listings become unreadable
- Corruption affects the ENTIRE session from start to finish — there are no readable sections once it begins. All text including system messages, tool output, and model responses is affected uniformly
- The corruption gets progressively worse with continued usage — text that was briefly readable at session start becomes completely garbled after 10-15 minutes of interaction
- The issue is most prominent in VS Code integrated terminal and JupyterLab terminal on macOS, but also affects standalone Terminal.app. Highlighting text with the mouse sometimes reveals the underlying correct characters while simultaneously corrupting previously-legible adjacent text
Error signatures
garbled text
corrupted terminal display
gibberish characters
unreadable output
terminal rendering corruption
kitty keyboard protocol
Possible causes
- Claude Code v2.1.142 (May 14, 2026) introduced the /goal command which uses advanced terminal escape sequences for multi-panel rendering. These escape sequences interact poorly with terminal emulators that don't fully support the kitty keyboard protocol (modifyOtherKeys mode). The /goal command writes escape sequences that some terminal emulators misinterpret as character data rather than control sequences, causing progressive display buffer corruption that accumulates with each new output chunk.
- The corruption is specifically related to 'enhanced keyboard mode' (kitty keyboard protocol / modifyOtherKeys) which Claude Code enables for rich terminal interaction. Terminal emulators using xterm.js (VS Code integrated terminal, JupyterLab terminal) have known limitations with certain advanced escape sequence handling — they may partially process kitty protocol sequences, leaving orphaned control characters in the display buffer that manifest as garbled text.
- VS Code's integrated terminal and JupyterLab's terminal use xterm.js with a limited set of supported escape sequences. When Claude Code sends sequences outside this set (particularly the CSI > 4 ; 1 m sequence for modifyOtherKeys or the CSI = 1 ; 1 s sequence for kitty keyboard), xterm.js may emit the raw bytes to the display instead of silently ignoring them. The corruption pattern — progressive degradation rather than immediate failure — suggests the terminal state machine accumulates errors rather than rejecting a single bad sequence.
Solutions
Diagnose Terminal Protocol Compatibility (Debug Which Feature Causes Corruption)
Run Claude Code with debug logging to identify which escape sequences or terminal protocol features trigger the corruption on your setup. This helps determine whether the issue is kitty keyboard protocol, /goal command, or another feature — and allows you to selectively disable the problematic feature.
- Enable debug logging: `ANTHROPIC_LOG=debug claude 2>&1 | tee /tmp/claude-debug.log`
- Use Claude Code normally until corruption appears
- Search the debug log for terminal-related sequences: `grep -E '(kitty|modifyOtherKeys|CSI|escape|terminal)' /tmp/claude-debug.log`
- Check your terminal's protocol support: `echo $TERM` and `infocmp` (if available)
- If using kitty terminal, test with kitty protocol disabled: `KITTY_KEYBOARD_PROTOCOL=0 claude`
Commands
ANTHROPIC_LOG=debug claude 2>&1 | tee /tmp/claude-debug.log
grep -E '(kitty|modifyOtherKeys|terminal)' /tmp/claude-debug.log | head -20
echo "TERM=$TERM"
infocmp 2>/dev/null | head -5
# Test without kitty keyboard protocol:
KITTY_KEYBOARD_PROTOCOL=0 claude
Risks
- Debug logging may expose API keys or session data in the log file — review before sharing
- Disabling kitty keyboard protocol may break other terminal features
- This is a diagnostic approach, not a permanent fix
Verification
- Step 1: Run `ANTHROPIC_LOG=debug claude 2>&1 | grep -c 'kitty'` → expect: count of kitty-related log entries (non-zero if protocol is active)
- Step 2: Run `echo $TERM` → expect: your terminal type (e.g., 'xterm-256color' for VS Code, 'xterm-kitty' for Kitty)
- Step 3: Test with `KITTY_KEYBOARD_PROTOCOL=0 claude -p 'hello'` → expect: clean output without garbled characters (if corruption was protocol-related)
Downgrade to v2.1.141 (Last Known-Good Before /goal Regression)
v2.1.141 (May 13, 2026) is the last version before the /goal command was introduced in v2.1.142. Users who downgrade to v2.1.141 report no terminal corruption issues — this version does not include the /goal command or its associated terminal escape sequences. This is the most reliable solution if you don't need the /goal feature. Pin the version to prevent npm from auto-upgrading on next install.
- Uninstall current version: `npm uninstall -g @anthropic-ai/claude-code`
- Install v2.1.141: `npm install -g @anthropic-ai/claude-code@2.1.141`
- Verify version: `claude --version`
- Check npm doesn't auto-upgrade: `npm list -g @anthropic-ai/claude-code`
- Optionally, pin the version in your shell profile to prevent accidental upgrades
Commands
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code@2.1.141
claude --version
npm list -g @anthropic-ai/claude-code
# Pin version in shell rc file:
echo 'alias claude="npx -y @anthropic-ai/claude-code@2.1.141"' >> ~/.zshrc
Config examples
# Pin Claude Code to v2.1.141 in ~/.zshrc or ~/.bashrc:
alias claude='npx -y @anthropic-ai/claude-code@2.1.141'
# Or use a shell function to warn if not pinned:
claude() {local ver=$(claude --version 2>/dev/null | grep -oP '[0-9]+\.[0-9]+\.[0-9]+')
if [ "$ver" != "2.1.141" ]; then
echo 'WARNING: Expected v2.1.141, got v'$ver
fi
npx -y @anthropic-ai/claude-code@2.1.141 "$@"
}
Risks
- Loses all fixes and features from v2.1.142+ including security patches, bug fixes, and new commands
- May miss important fixes for other issues (OAuth, MCP, permissions)
- The npx alias approach is slower on first run (~2-5s) as it downloads the package
Verification
- Step 1: Run `claude --version` → expect: exact output '2.1.141' (no higher version)
- Step 2: Run `npm list -g @anthropic-ai/claude-code` → expect: '@anthropic-ai/claude-code@2.1.141' with no other versions
- Step 3: Use Claude Code for 15+ minutes in VS Code terminal with multiple tool calls and /commands → expect: no garbled text, no display corruption, clean ASCII output throughout
- Step 4: Run `claude -p 'show a git diff --stat'` → expect: clean table output with proper borders and readable filenames
Resize Terminal or Toggle Full-Screen (Immediate Visual Recovery)
Terminal resize triggers a full redraw of the terminal buffer via the SIGWINCH signal, which forces the terminal emulator to re-render all visible text from the backing buffer. In VS Code, toggling full-screen mode (F11 or View > Appearance > Full Screen) or resizing the terminal panel forces the terminal emulator to re-render, restoring readability. Another reliable method: use /save to persist session state, then /resume in a fresh terminal to restore the session with a clean display buffer. This is not a permanent fix — corruption will return with continued usage — but it allows you to read current output and continue working without restarting.
- When terminal text is garbled, resize the terminal window slightly — any dimension change triggers a redraw
- In VS Code: press F11 twice (enter and exit full-screen) to force a terminal redraw
- Alternatively in VS Code: Ctrl+` to close the terminal panel, then Ctrl+` again to reopen — this reinitializes the terminal
- In standalone Terminal.app: resize the window by dragging a corner
- In JupyterLab: resize the browser window or drag the terminal panel divider
- If corruption is severe and resize doesn't help: type `/save` to save session, exit Claude Code, then `claude --resume` to restore
Commands
# Quick terminal reset without leaving Claude Code:
# Ctrl+L — Clear screen (may not fix buffer corruption)
# Resize window — most reliable quick fix
# In Claude Code session:
/save
# Then exit and resume:
claude --resume
Config examples
# VS Code keyboard shortcuts for terminal recovery:
# F11 — Toggle Full Screen (forces complete terminal redraw)
# Ctrl+` — Toggle Terminal Panel (reinitializes terminal process)
# Ctrl+Shift+P → 'Terminal: Clear' — Clear terminal buffer
# Add to VS Code keybindings.json for quick terminal reset:
# { "key": "ctrl+shift+r", "command": "workbench.action.terminal.clear" }Risks
- Temporary fix only — corruption will return as more output is generated, typically within 5-15 minutes
- /save and /resume may lose some in-memory session context depending on what's cached to disk
- Repeated terminal resets may interrupt tool calls in progress
Verification
- Step 1: When terminal text is garbled, press F11 twice in VS Code → expect: text renders cleanly with correct ASCII characters immediately after returning from full-screen
- Step 2: Run `/save` in Claude Code, then `claude --resume` in a fresh terminal → expect: session resumes with readable text and previous context intact
- Step 3: After a resize recovery, run `claude -p 'show me a git diff'` → expect: git diff output renders with clean +/- symbols and no garbled characters
Upgrade to v2.1.144+ and Verify Fix (Official Fix — diana-ant Confirmed)
Anthropic staff (diana-ant) confirmed the fix shipped in v2.1.144 (May 18, 2026): 'Hello, this issue should have been fixed in v2.1.144. Could you please try to update and confirm if it hasn't? Thanks!' Claude bot also marked: 'This issue was fixed as of version 2.1.144.' Upgrade to the latest version and test. However, multiple users report the corruption persists in v2.1.144 and v2.1.145 in VS Code and JupyterLab terminals — the fix may be partial. If corruption persists after upgrade, proceed to Solution 2 (terminal resize workaround) or Solution 3 (downgrade).
- Upgrade Claude Code: `npm install -g @anthropic-ai/claude-code@latest`
- Verify version: `claude --version` — expect output >= 2.1.144
- Check which binary you're running: `file $(which claude)` — expect standalone binary or Node.js script
- Start a new Claude Code session and avoid using /goal command during testing
- Monitor terminal output for corruption over a 10-15 minute session with multiple tool calls
- If corruption persists, try the VS Code terminal resize workaround (Solution 2) or downgrade (Solution 3)
Commands
npm install -g @anthropic-ai/claude-code@latest
claude --version
file $(which claude)
# Quick test without entering interactive mode:
claude -p 'list files in current directory in a table format'
# Check if running in kitty mode:
echo $TERM
Risks
- The fix in v2.1.144 is unconfirmed — multiple users on v2.1.144 and v2.1.145 still see corruption, especially in VS Code and JupyterLab terminals
- The /goal command may still trigger corruption even in fixed versions; avoid it if you experience issues
Verification
- Step 1: Run `claude --version` → expect: version >= 2.1.144 (e.g., '2.1.175' as of June 2026)
- Step 2: Run `file $(which claude)` → expect: 'ELF 64-bit' (Linux), 'Mach-O 64-bit' (macOS), or a Node.js script — confirms correct binary
- Step 3: Start a session and run `claude -p 'list files in a table'` → expect: clean ASCII table borders (│, ─, ┌) with readable text, no garbled symbols
- Step 4: Interact for 5+ minutes with multiple tool calls → expect: all text remains consistently readable with no progressive degradation
Agent JSON
Canonical machine-readable representation of this issue:
{
"issue_id": "1e672e1e-ce94-4a05-8b6b-b96e1b5f1ae8",
"slug": "fix-claude-code-terminal-display-corruption-garbled-characters-gibberish-text-and-unreadable-output-in-macos-terminal-vs-81riuc",
"verification_status": "unverified",
"canonical_json": "https://codekb.dev/v1/issues/fix-claude-code-terminal-display-corruption-garbled-characters-gibberish-text-and-unreadable-output-in-macos-terminal-vs-81riuc"
}