Skip to content

[BUG] VSCode: sessions-index.json severely out of sync - only 3 of 61 sessions indexed, older sessions invisible in UI #29331

Closed as not planned

Description

@xmeloun

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 sessions-index.json file is severely out of sync with actual session files on disk. In my case:

  • 61 .jsonl session files exist in the project directory (~/.claude/projects/<project>/)
  • Only 3 sessions are listed in sessions-index.json
  • The remaining 58 sessions are invisible in the VSCode extension UI - they don't appear in the "Past Conversations" dropdown, they can't be found via the search box, and they are not resumable

Specific reproduction scenario:

  1. Had a conversation session from Feb 13, 2026 (1.2 MB, 154 lines, 64 assistant messages) - verified intact and uncorrupted on disk
  2. The session tab was visible in VSCode tab bar with its title
  3. When clicking the tab to open it, the session disappeared from the UI entirely
  4. The .jsonl file remains on disk, intact and parseable
  5. The session is NOT in sessions-index.json
  6. Searching in the session search box does not find it
  7. cleanupPeriodDays is set to 99999 in settings.json - files are not being deleted, just not indexed

The root cause appears to be that sessions-index.json stops updating at some point, leaving newly created sessions unindexed and invisible to the UI.

Related Issues

This appears to be the same underlying issue as:

The common thread across all these issues is that sessions-index.json becomes stale/corrupt and stops tracking new sessions.

Suggested Fix

  1. The UI should rebuild/reconcile the index by scanning .jsonl files on disk when a mismatch is detected
  2. Or provide a manual "rebuild session index" command
  3. The index write operation should be more resilient (perhaps atomic writes, or a recovery mechanism)

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Claude Code: VSCode Extension (latest)
  • Shell: Git Bash
  • Project sessions on disk: 61
  • Sessions in index: 3
  • cleanupPeriodDays: 99999

Activity

  1. added
    bugSomething isn't working
    duplicateThis issue or pull request already exists
    has reproHas detailed reproduction steps
    platform:vscodeIssue specifically occurs in VS Code
    platform:windowsIssue specifically occurs on Windows
    on Feb 27, 2026
  2. github-actions commented on Feb 27, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. sessions-index.json not updated - claude -c fails to find sessions #22462
    2. Sessions-index.json: summaries not generated and new sessions not indexed since ~v2.1.31 #24729
    3. [BUG] Past conversations not showing in dropdown - sessions-index.json not being updated. #18619

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  3. xmeloun commented on Feb 27, 2026

    @xmeloun
    Author

    Additional findings after investigation

    sessions-index.json rebuild does NOT fix the issue

    I rebuilt sessions-index.json from scratch by scanning all 61 .jsonl files on disk. The rebuilt index has correct format (matching the original working entries exactly - same fields, same structure). After VSCode restart, the missing sessions still don't appear in the UI.

    This confirms the VSCode extension does not rely on sessions-index.json for populating the "Past Conversations" list. It uses its own internal mechanism.

    Sessions disappear from OPEN TABS too

    While investigating this bug, another session ("JANA NEDVĚDOVÁ: Nákupní...") disappeared from the UI. The user had it open as a tab in VSCode - when they clicked the tab, the session vanished. The .jsonl file remains intact on disk.

    Extension's internal state

    Checked VSCode's global state database (state.vscdb). The Anthropic.claude-code key contains only 5 fields (settingsMigrated, lastClaudeLocation, experimentGates, lastClaudeLocationMigrated, yearEndPromoViewCount) - no session tracking data.

    Key facts:

    • 61 .jsonl files on disk, all intact and parseable
    • Only ~8 sessions visible in the UI (the rest are invisible)
    • cleanupPeriodDays: 99999 - files are NOT being deleted
    • Rebuilding sessions-index.json with all 61 entries has no effect
    • Sessions can disappear even from open tabs when clicked
    • Extension version: anthropic.claude-code-2.1.61-win32-x64
    • OS: Windows 11 Pro

    Difference from duplicates #22462, #24729, #18619

    Those issues focus on sessions-index.json sync problems. This report demonstrates that even with a perfectly rebuilt index, sessions remain invisible, pointing to a deeper issue in the extension's session management, not just index file sync.

  4. github-actions commented on Mar 28, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  5. xmeloun commented on Mar 31, 2026

    @xmeloun
    Author

    Still reproducible on v2.1.72 (2026-03-31)

    This bug is still present on the latest VS Code extension version anthropic.claude-code-2.1.72-win32-x64, Windows 11 Pro.

    Current state:

    • 247 .jsonl session files exist on disk in ~/.claude/projects/<project>/
    • Only a fraction of them appear in the "Past conversations" dropdown
    • Sessions from 2 days ago are missing from the UI
    • cleanupPeriodDays: 99999 — files are NOT being deleted
    • sessions-index.json rebuild has no effect (as documented in my previous comment)

    Nothing has changed since the original report — the extension still fails to list all sessions. The core issue remains: the VS Code extension's internal session discovery mechanism silently drops older/some sessions from the UI while the files remain intact on disk.

    CLI workaround confirms data is there:
    claude --resume in the terminal correctly lists and can resume ALL sessions, including those invisible in the VS Code extension UI.

    Please reopen — this was auto-closed as stale, not as fixed.

  6. github-actions commented on Apr 8, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  7. locked as resolved and limited conversation to collaborators on Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:vscodeIssue specifically occurs in VS Codeplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions