claude-code - 💡(How to fix) Fix [BUG] Scrollback duplication on terminal resize — bisected to 2.1.101 (still present in 2.1.119) [2 comments, 2 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#53248Fetched 2026-04-26 05:20:36
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2closed ×1cross-referenced ×1

Fix Action

Fix / Workaround

Mitigation tradeoff users currently face

Code Example

tmux kill-session -t cctest 2>/dev/null
tmux new-session -d -s cctest -x 120 -y 40
tmux send-keys -t cctest 'claude --dangerously-skip-permissions' C-m
sleep 10                                                          # let CC start

# 6 resizes
for w in 80 100 140 90 130 120; do
  tmux resize-window -t cctest -x $w -y 40
  sleep 1
done
sleep 2

# Count copies of the version banner — should be 1, will be 7
tmux capture-pane -t cctest -p -S -2000 | grep -c 'Claude Code v'

---

▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd

────────────────────────────────────────────────────────────  (60-col, initial render)
────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)

 ▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd

────────────────────────────────────────────────────────────────────────────────  (80-col, leaked from first resize)
────────────────────────────────────────────────────────────────────────────────
  [Haiku 4.5] shared-cwd
  ⏵⏵ bypass permissions on (shift+tab to cycle)
 ▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd
... (continues, one full UI block per subsequent resize) ...
RAW_BUFFERClick to expand / collapse

What's Wrong?

Claude Code's TUI renders into tmux's primary buffer (not the alternate screen). As of 2.1.101, every TUI re-render emits a fresh frame into the buffer without scrolling back over the prior render — so each terminal resize (SIGWINCH) and each in-conversation state change (tool call, etc.) leaves the previous frame stranded in scrollback. This stacks up rapidly and pollutes the user's terminal history with duplicates of the welcome logo, prompt chrome, and assistant message bodies.

It's especially severe in mobile / tmux-on-web setups where SIGWINCH fires constantly (URL bar show/hide, soft keyboard open/close, orientation changes, tab switches).

What Should Happen?

Each re-render should overwrite the prior frame in place (as 2.1.100 does), not append a fresh frame below it. Resizing the terminal should not produce any duplicate UI lines in scrollback.

Steps to Reproduce

Minimal repro — no API calls needed, just terminal resize triggers it:

tmux kill-session -t cctest 2>/dev/null
tmux new-session -d -s cctest -x 120 -y 40
tmux send-keys -t cctest 'claude --dangerously-skip-permissions' C-m
sleep 10                                                          # let CC start

# 6 resizes
for w in 80 100 140 90 130 120; do
  tmux resize-window -t cctest -x $w -y 40
  sleep 1
done
sleep 2

# Count copies of the version banner — should be 1, will be 7
tmux capture-pane -t cctest -p -S -2000 | grep -c 'Claude Code v'

Expected: 1. Actual on 2.1.101 → 2.1.119: 7 (one initial + 6 leaked copies, exactly one per resize event).

A second harness that prompts CC for a 3-line response then resizes 6 times shows the conversation content itself leaks +30 lines (5 copies per resize). Long conversations get catastrophic.

Bisection result

Tested every Linux x64 native build available on downloads.claude.ai from 2.1.100 through 2.1.119, 3 runs each on the bounding versions:

VersionCDN upload (UTC)Leak count (6 resizes)
2.1.1002026-04-10 04:550 (clean)
2.1.1012026-04-10 18:366 (regression lands)
2.1.1022026-04-11 20:246
2.1.1032026-04-11 23:096
2.1.1042026-04-12 02:206
2.1.1052026-04-13 19:456
2.1.1092026-04-15 03:376
2.1.1102026-04-15 20:256
2.1.1132026-04-17 18:546 (first native build)
2.1.1142026-04-17 23:116
2.1.1162026-04-20 19:106 (see note below)
2.1.1172026-04-21 21:386
2.1.1182026-04-22 23:276
2.1.1192026-04-23 21:166

The flip is exact and reproducible at the 2.1.100 → 2.1.101 boundary (released ~14 hours apart on 2026-04-10).

Note on the 2.1.116 changelog entry

The 2.1.116 changelog says:

Fixed scrollback duplication in inline mode where resizing the terminal or large output bursts would repeat earlier conversation history

The above harness shows 2.1.116 still leaks 6 copies on 6 resizes, identical to 2.1.101 and to the current 2.1.119. Either that fix targeted a narrower case (mid-stream burst dup?) or it was regressed in a later release. The "resizing the terminal" wording in the changelog matches exactly what this issue reproduces.

Visual evidence

tmux capture-pane after the 6-resize harness on 2.1.101 (clean would have one frame, this has many — each at the width set by the corresponding resize):

 ▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd

────────────────────────────────────────────────────────────  (60-col, initial render)
────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)

 ▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd

────────────────────────────────────────────────────────────────────────────────  (80-col, leaked from first resize)
────────────────────────────────────────────────────────────────────────────────
  [Haiku 4.5] shared-cwd
  ⏵⏵ bypass permissions on (shift+tab to cycle)
 ▐▛███▜▌   Claude Code v2.1.101
▝▜█████▛▘  Haiku 4.5 with medium effort · Claude Max
  ▘▘ ▝▝    ~/test/shared-cwd
... (continues, one full UI block per subsequent resize) ...

Same harness on 2.1.100 produces a single block followed by blank lines — the prior render is properly overwritten in place.

Mitigation tradeoff users currently face

Opus 4.7 was added in 2.1.111 (2026-04-16), six days after the leak landed in 2.1.101. There is no version that has both Opus 4.7 and clean scrollback rendering — downgrading to 2.1.100 caps the user at Opus 4.6.

Environment

  • claude --version: 2.1.119 (Claude Code)
  • Last working version: 2.1.100
  • Platform: Anthropic API
  • OS: Linux (Ubuntu)
  • Terminal: tmux (also reproduces via xterm.js/tmux web clients; native xterm + tmux on Linux reproduces identically)
  • Model used in repro: Haiku (model is irrelevant; the bug fires before any prompt is sent)

Related upstream context

Issue #44864 (primary-buffer rendering) and #2479 (avoid clearing scrollback) cover the broader "CC renders in primary buffer" architecture. This issue is specifically about the regression that 2.1.101 introduced on top of that architecture — re-renders no longer overwrite in place.

extent analysis

TL;DR

Downgrade to version 2.1.100 to fix the scrollback duplication issue in Claude Code.

Guidance

  1. Verify the issue: Run the provided repro harness to confirm the scrollback duplication issue on your system.
  2. Check version compatibility: Ensure you are running a version between 2.1.101 and 2.1.119, where the issue is known to exist.
  3. Assess the tradeoff: Consider the tradeoff between downgrading to 2.1.100 (which fixes the issue but limits you to Opus 4.6) and staying on a newer version with Opus 4.7 but experiencing the scrollback duplication issue.
  4. Monitor for updates: Keep an eye on future releases for a fix that addresses both the scrollback issue and includes Opus 4.7 or later.

Example

No code snippet is provided as the issue is related to a specific version regression rather than a code fix.

Notes

The provided bisection result and repro harness suggest a clear regression introduced in version 2.1.101. However, without access to the Claude Code source or more detailed information on the changes made between versions, a precise code-level fix cannot be provided.

Recommendation

Apply the workaround by downgrading to version 2.1.100, as it is the last known version without the scrollback duplication issue, despite the limitation of being capped at Opus 4.6.

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