claude-code - 💡(How to fix) Fix [BUG] Conversation duplication on file writes persists in v2.1.x (re: closed issue #15476) [1 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#53750Fetched 2026-04-28 06:48:12
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

  • React error #185 (rendering / state-management)

Error Messages/Logs

Root Cause

The original report (#15476) was auto-closed by the stale bot on inactivity, not because it was resolved. The reporter documented:

Fix Action

Fix / Workaround

Note on version mismatch: the CLI is 3 patch versions behind the VS Code extension. Both were installed via official channels (npm install -g @anthropic-ai/claude-code and the VS Code Marketplace respectively). It's unclear whether this mismatch contributes; surfacing it in case it's relevant to the rendering pipeline.

  • Affects long working sessions where file writes are routine
  • Documented escalation to settings file corruption is a real reliability concern
  • Workaround (running Claude Code in a non-VS-Code terminal) is feasible but isolates the bug to the VS Code rendering pipeline, which is a heavily-used context for many users
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?

The conversation-duplication bug originally reported in #15476 (closed as stale, not fixed) is still present in Claude Code v2.1.x and reproduces under the same conditions described in that issue.

When Claude Code writes or edits files during a session, the conversation UI in the VS Code integrated terminal duplicates rendered content - assistant messages and surrounding context appear multiple times, scrollbar position jumps, and the previously rendered output is re-rendered after the file-write tool call completes.

This was previously logged in a private working journal on 24 April 2026 (could not diagnose at the time) and reproduced again on 27 April 2026 in a code-heavy session. Both occurrences match the symptom pattern in #15476.

| OS | Windows 11 Pro 10.0.26200 | | Terminal | VS Code integrated terminal | | Shell | Bash (Git Bash) | | Claude Code CLI | 2.1.117 | | VS Code extension (anthropic.claude-code) | 2.1.120 | | Model | Claude Opus 4.7 (1M context) | | Platform | Anthropic API |

Note on version mismatch: the CLI is 3 patch versions behind the VS Code extension. Both were installed via official channels (npm install -g @anthropic-ai/claude-code and the VS Code Marketplace respectively). It's unclear whether this mismatch contributes; surfacing it in case it's relevant to the rendering pipeline.

The original report (#15476) was auto-closed by the stale bot on inactivity, not because it was resolved. The reporter documented:

  • Conversation duplicating 3-5x on file writes
  • React error #185 (rendering / state-management)
  • EBADF: bad file descriptor errors on history.jsonl.lock
  • Escalation to settings.local.json corruption
  • Forced session resets losing conversation history

I am surfacing this fresh report because:

  1. The bug clearly persists in v2.1.x (over a year after the original v2.0.75 report)
  2. Auto-close happened without an engineer triaging the underlying race condition
  3. The corruption-escalation path documented in #15476 represents real data-loss risk for users running long working sessions

Race condition between the UI rendering pipeline and concurrent file-handle operations on history.jsonl / history.jsonl.lock. When the UI re-renders after a tool call completes, file handles can be invalidated mid-operation, producing the EBADF errors and the rendering duplication observed.

  • Affects long working sessions where file writes are routine
  • Documented escalation to settings file corruption is a real reliability concern
  • Workaround (running Claude Code in a non-VS-Code terminal) is feasible but isolates the bug to the VS Code rendering pipeline, which is a heavily-used context for many users

What Should Happen?

  • Each assistant message should render exactly once
  • File-write tool calls (Write, Edit) should not trigger re-rendering of preceding conversation content
  • Scrollbar position should remain stable when tool calls complete

Error Messages/Logs

Steps to Reproduce

  1. Open Claude Code in VS Code integrated terminal (Bash) on Windows 11
  2. Start a session that involves the assistant using Write or Edit tools (i.e. any code-heavy or file-writing work)
  3. Observe duplication appearing after tool calls return

In the 27 April 2026 reproduction, the trigger was a Write tool call creating a new file at C:\REDACTED\<service>\secrets.json. Duplication appeared immediately after the tool completed.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.120

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

extent analysis

TL;DR

The conversation-duplication bug in Claude Code v2.1.x can be potentially fixed by addressing the race condition between the UI rendering pipeline and concurrent file-handle operations.

Guidance

  • Investigate the rendering pipeline in the VS Code integrated terminal to identify the root cause of the duplication issue.
  • Verify if the version mismatch between the CLI (2.1.117) and the VS Code extension (2.1.120) contributes to the problem.
  • Consider implementing a locking mechanism to prevent concurrent access to history.jsonl and history.jsonl.lock files.
  • Test the workaround of running Claude Code in a non-VS-Code terminal to isolate the bug to the VS Code rendering pipeline.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue is a regression, and the last working version is not specified. The corruption-escalation path documented in #15476 represents a real data-loss risk for users.

Recommendation

Apply workaround: running Claude Code in a non-VS-Code terminal, as it isolates the bug to the VS Code rendering pipeline and provides a temporary solution until the root cause is addressed.

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

claude-code - 💡(How to fix) Fix [BUG] Conversation duplication on file writes persists in v2.1.x (re: closed issue #15476) [1 participants]