VirtualMessageList itemKeys/messages length desync in long Claude Code session
Bug Description
While using Claude Code to help organize cybersecurity study notes from a Hack The Box module for my Obsidian knowledge base, Claude Code encountered an internal UI/message rendering error.
The session contained a relatively long conversation, and Claude Code appears to have lost synchronization between the number of message keys and the number of messages stored/rendered.
Problem Encountered
I was working normally in a long Claude Code session, using it to structure and organize cybersecurity notes for my personal training.
During the session, Claude Code produced an internal error related to the virtual message list.
I did not intentionally modify Claude Code's internal state or message history.
Error Message / Unexpected Behavior
The following error was generated:
TelemetrySafeError: VirtualMessageList: itemKeys/messages length desync
(keys=488 messages=485 range=[463,488))
The stack trace points to the Claude Code CLI internals.
This suggests that Claude Code had 488 message/item keys but only 485 corresponding messages, causing the virtual message list to become desynchronized.
Expected Behavior
Claude Code should continue displaying and processing the conversation normally, even during long sessions, without the internal message list becoming desynchronized.
If a message fails to render or load, Claude Code should recover gracefully rather than leaving the message list in an inconsistent state.
Actual Behavior
Claude Code reported an internal VirtualMessageList synchronization error:
itemKeys: 488messages: 485- Affected range:
[463,488)
This occurred during a long-running conversation containing cybersecurity study notes.
Reproduction Context
I do not currently have a minimal deterministic reproduction.
The issue occurred during a relatively long Claude Code session with several hundred messages/items. The conversation involved creating and organizing Hack The Box cybersecurity study notes for use in Obsidian.
The large conversation length may be relevant to reproducing the problem.
Environment
- Platform: win32
- Terminal: xterm-256color
- Claude Code Version: 2.1.241
- Feedback ID: 7e38d041-bbfc-4fdf-8fb1-cb3819bcce38
- Error timestamp: 2026-08-24T15:40:26.743Z
Full Error
[{"error":"TelemetrySafeError: VirtualMessageList: itemKeys/messages length desync (keys=488 messages=485 range=[463,488))\n at X20 (B:/~BUN/root/cli:23311:34430)\n at mCg (B:/~BUN/root/cli:23311:27293)\n at Fr (B:/~BUN/root/cli:2993:21427)\n at qc (B:/~BUN/root/cli:2993:40531)\n at Ss (B:/~BUN/root/cli:2993:51459)\n at Oze (B:/~BUN/root/cli:2993:89122)\n at $7e (B:/~BUN/root/cli:2993:88070)\n at pae (B:/~BUN/root/cli:2993:87890)\n at pv (B:/~BUN/root/cli:2993:84152)\n at mt (B:/~BUN/root/cli:2993:6693)","timestamp":"2026-08-24T15:40:26.743Z"}]