[BUG] Conversation duplication on file writes persists in v2.1.x (re: closed issue #15476)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] 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 descriptorerrors onhistory.jsonl.lock- Escalation to
settings.local.jsoncorruption - Forced session resets losing conversation history
I am surfacing this fresh report because:
- The bug clearly persists in v2.1.x (over a year after the original v2.0.75 report)
- Auto-close happened without an engineer triaging the underlying race condition
- 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
- Open Claude Code in VS Code integrated terminal (Bash) on Windows 11
- Start a session that involves the assistant using
WriteorEdittools (i.e. any code-heavy or file-writing work) - 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_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗