Terminal Emulator Rendering Artifacts — Fix (2026)
The Error
[Garbled terminal output]
←[0m←[1m←[38;5;208m Claude Code ←[0m←[2m v1.2.3←[0m
^[[A^[[B^[[D — ghost ANSI escape sequences visible in output
Terminal prompt corrupted after Claude Code streaming response
This appears when ANSI escape codes leak into the terminal output, causing garbled text, invisible characters, ghost cursor movements, or corrupted prompts.
The Fix
reset
claude
- Run the
resetcommand to reinitialize the terminal state and clear all ANSI modes. - If
resetis not available, pressCtrl+Lto clear the screen and trytput reset. - Restart Claude Code in the cleaned terminal.
Why This Happens
Claude Code uses ANSI escape codes for colors, bold text, progress spinners, and cursor movement. When a streaming response is interrupted (Ctrl+C, network drop, or crash), the terminal may be left in an altered state (wrong color mode, hidden cursor, alternate screen buffer). Some terminal emulators do not properly handle the rapid escape code sequences that Claude Code produces during streaming, causing them to render raw escape characters instead.
If That Doesn’t Work
Clear ANSI state manually:
printf '\033[0m\033[?25h\033[?1049l'
Switch to a simpler output mode:
export TERM=xterm
export NO_COLOR=1
claude
Try a different terminal emulator (iTerm2, Alacritty, or Kitty handle ANSI better than Terminal.app):
# Install a better terminal:
brew install --cask iterm2
# Or:
brew install --cask alacritty
Prevention
# CLAUDE.md rule
If terminal output becomes garbled, run 'reset' and restart Claude Code. Use iTerm2 or Alacritty for best rendering compatibility. Set NO_COLOR=1 if you do not need colored output.
Related
- process exited with code 1 fix — How to fix Claude Code process exited with code 1 error
- Claude Code Terminal UTF-8 Garbled Output — Fix (2026)
Related Error Messages
This fix also applies if you see these related error messages:
UnicodeDecodeError: 'utf-8' codec can't decode byteError: invalid byte sequence in UTF-8Buffer encoding not recognizednpm ERR! code ENOENTError: Cannot find module '@anthropic-ai/claude-code'
Frequently Asked Questions
Why does Claude Code produce encoding errors?
Claude Code assumes UTF-8 encoding for all text files. Files saved with other encodings (Latin-1, Windows-1252, Shift-JIS) contain byte sequences that are invalid in UTF-8. Convert files to UTF-8 before editing: iconv -f WINDOWS-1252 -t UTF-8 file.txt > file_utf8.txt.
How do I check a file’s encoding?
Run file -bi filename on Linux or file -I filename on macOS. The output includes the charset. If it shows anything other than utf-8 or us-ascii, the file may cause encoding errors in Claude Code.
Can Claude Code handle binary files?
Claude Code can read binary files like images (it is multimodal) but cannot edit them as text. Attempting to open a binary file as text produces garbled output or encoding errors. Use appropriate tools (ImageMagick, ffmpeg) for binary file manipulation.
What is the recommended way to install Claude Code?
Install globally with npm: npm install -g @anthropic-ai/claude-code. This adds the claude command to your PATH. Verify the installation with claude --version. Requires Node.js 18 or later.
Related Guides
Quick setup → Launch your project with our Project Starter.
Try it: Paste your error into our Error Diagnostic for an instant fix.