claude-code - 💡(How to fix) Fix [BUG] Progressive text rendering corruption in long-running terminal sessions (macOS / Electron)

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…

Error Message

Error Messages/Logs

Root Cause

Frame times look healthy in isolation — which suggests the corruption is not caused by frame drops but by ANSI state accumulation over time.

Fix Action

Fix / Workaround

Workarounds

WorkaroundResult
Restart CLI session✅ Clears corruption immediately
reset command in terminal⚠️ Partial improvement
Ctrl+O transcript mode✅ Bypasses TUI rendering entirely
Locale already C.UTF-8N/A — encoding is correct

Code Example

# No explicit errors thrown. Operations succeed; the issue is purely visual.
# Corruption manifests as:
#   - Block characters () replacing normal text
#   - Garbled/shifted glyphs mid-word
#   - Characters from wrong character sets appearing inline
#   - Diff line content corrupted while diff highlight colors remain intact

---

2.1.142 (Claude Code)

---

macOS 26.4.1 (Build 25E253)
Darwin Kernel 25.4.0, ARM64 (Apple M2 Max, 12-core, 32 GB)
Shell: /bin/zsh
Locale: C.UTF-8
TERM: dumb
Node.js: v22.20.0
npm: 10.9.3

---

{
  "model": "claude-sonnet-4-6[1m]",
  "editorMode": "vim",
  "alwaysThinkingEnabled": true,
  "effortLevel": "xhigh",
  "showSpinnerTree": false,
  "statusLine": {
    "type": "command",
    "command": "bash -c '... printf \"%s@%s %s %%\" ...'"
  },
  "enabledPlugins": [
    "frontend-design",
    "ralph-loop",
    "superpowers",
    "context7",
    "github",
    "playwright"
  ],
  "hooks": {
    "PermissionRequest": [{ "type": "command", "command": "afplay ...", "async": true }]
  }
}

---

frame_duration_ms_count: 44
frame_duration_ms_min:   0.076 ms
frame_duration_ms_max:   4.816 ms
frame_duration_ms_avg:   1.095 ms
frame_duration_ms_p50:   0.801 ms
frame_duration_ms_p95:   3.760 ms
frame_duration_ms_p99:   4.468 ms
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

In long-running sessions (25+ hours), terminal output progressively develops text rendering corruption. Characters are replaced with garbled glyphs, block characters (█), and wrong-charset substitutions across all output types:

  1. Task summary lines — the task name, elapsed time, and token/cost metadata render as solid red/dark blocks with unreadable characters. The subtask text beneath remains partially legible.
  2. Structured lists — numbered items show sporadic glyph corruption mid-word. Some items render cleanly while adjacent items are garbled (e.g., list items 2, 4, 5 corrupted while 1, 3, 6 are fine).
  3. Code diffs — the most severe: diff views show heavily corrupted text where YAML keys, variable names, and inline comments become unreadable, while the diff background colors (red/green) remain partially intact.

The corruption accumulates over time. Short sessions render correctly. After many hours of continuous use, corruption frequency and severity increase progressively. The underlying operations complete successfully — the bug is purely visual.

What Should Happen?

All terminal output should render legibly with correct character encoding regardless of session duration.

Error Messages/Logs

# No explicit errors thrown. Operations succeed; the issue is purely visual.
# Corruption manifests as:
#   - Block characters (█) replacing normal text
#   - Garbled/shifted glyphs mid-word
#   - Characters from wrong character sets appearing inline
#   - Diff line content corrupted while diff highlight colors remain intact

Steps to Reproduce

  1. Open Claude Code in an Electron-based IDE terminal (VS Code or similar) where TERM=dumb
  2. Start working on a multi-file project with varied output types (file edits, git diffs, structured plans)
  3. Keep the session running continuously for 10+ hours without restarting
  4. Observe progressive rendering degradation:
    • Early: occasional character replacements in status/summary lines
    • Mid: numbered lists show corrupted characters mid-word
    • Late (25h+): code diffs become nearly unreadable with pervasive glyph corruption
  5. Restarting the CLI session clears the corruption immediately

Reproduction confidence: Observed consistently across two separate 25+ hour sessions running concurrently. A third session running for ~35 minutes in the same environment showed clean rendering, confirming session duration as the primary variable.

Claude Model

Sonnet (default) — also observed when switching models mid-session; the bug is model-agnostic (rendering layer)

Is this a regression?

I don't know

Last Working Version

N/A — observed on current version; not sure about prior versions.

Claude Code Version

2.1.142 (Claude Code)

Platform

Google Vertex AI

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Environment Details

macOS 26.4.1 (Build 25E253)
Darwin Kernel 25.4.0, ARM64 (Apple M2 Max, 12-core, 32 GB)
Shell: /bin/zsh
Locale: C.UTF-8
TERM: dumb
Node.js: v22.20.0
npm: 10.9.3

Claude Code Configuration (relevant settings)

{
  "model": "claude-sonnet-4-6[1m]",
  "editorMode": "vim",
  "alwaysThinkingEnabled": true,
  "effortLevel": "xhigh",
  "showSpinnerTree": false,
  "statusLine": {
    "type": "command",
    "command": "bash -c '... printf \"%s@%s %s %%\" ...'"
  },
  "enabledPlugins": [
    "frontend-design",
    "ralph-loop",
    "superpowers",
    "context7",
    "github",
    "playwright"
  ],
  "hooks": {
    "PermissionRequest": [{ "type": "command", "command": "afplay ...", "async": true }]
  }
}

Session Rendering Metrics (from last session)

frame_duration_ms_count: 44
frame_duration_ms_min:   0.076 ms
frame_duration_ms_max:   4.816 ms
frame_duration_ms_avg:   1.095 ms
frame_duration_ms_p50:   0.801 ms
frame_duration_ms_p95:   3.760 ms
frame_duration_ms_p99:   4.468 ms

Frame times look healthy in isolation — which suggests the corruption is not caused by frame drops but by ANSI state accumulation over time.

Contributing Factors

Several configuration elements may compound the issue:

  • TERM=dumb — Electron-based IDE terminals typically report this, which disables Synchronized Output. The TUI renderer may emit ANSI sequences the terminal cannot fully process.
  • Custom statusLine — executes a shell command for the status bar, adding continuous rendering overhead.
  • 6 plugins enabled — increased rendering surface from plugin output.
  • alwaysThinkingEnabled + effortLevel: xhigh — longer response cycles mean more sustained rendering.
  • Multiple concurrent sessions — two 25h+ sessions running simultaneously in the same IDE may amplify buffer pressure.

Workarounds

WorkaroundResult
Restart CLI session✅ Clears corruption immediately
reset command in terminal⚠️ Partial improvement
Ctrl+O transcript mode✅ Bypasses TUI rendering entirely
Locale already C.UTF-8N/A — encoding is correct

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