Skip to content

Resume shows only partial conversation history due to stale sessions-index.json #22030

Closed

Description

@bryan-zxc

Description

When using --resume to resume a conversation, only a few recent messages appear instead of the full conversation history. The conversation data file contains the complete history, but sessions-index.json has incorrect/stale metadata.

Steps to Reproduce

  1. Have a long conversation with many messages
  2. Exit the session
  3. Resume with claude --resume and select the conversation
  4. Only the last few messages appear, earlier conversation history is missing

Investigation Findings

Examined the conversation files in ~/.claude/projects/<project>/:

  • Conversation file (*.jsonl): Contains 1480 lines with 678 user messages and 741 assistant messages
  • sessions-index.json: Shows messageCount: 3 and has incorrect firstPrompt

Example discrepancy:

Actual first message: "i want to run a detailed security review on this code base..."
sessions-index.json firstPrompt: "i want you to create a html file that look like a ppt..."

The firstPrompt in the index corresponds to a message from much later in the conversation, and messageCount is drastically underreported.

Expected Behaviour

  • sessions-index.json should accurately reflect the conversation's message count and first prompt
  • Resume should restore the full conversation history as stored in the .jsonl file

Actual Behaviour

  • sessions-index.json metadata becomes stale/out of sync with actual conversation file
  • Resume uses the incorrect index metadata, showing only partial history
  • Full conversation data IS preserved in the .jsonl file but not loaded

Environment

  • macOS (Darwin 24.6.0)
  • Issue occurred on multiple separate conversations

Workaround

The conversation data is intact. Deleting sessions-index.json may force a rebuild, though this hasn't been tested.

Activity

  1. github-actions commented on Jan 30, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] /resume index suddenly missing 80% of sessions #21610
    2. [BUG] Past conversations not showing in dropdown - sessions-index.json not being updated. #18619
    3. [BUG] Sessions index has wrong path information #20102

    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

  2. tamasarpad commented on Feb 1, 2026

    @tamasarpad

    Found 3 possible duplicate issues:

    1. [BUG] /resume index suddenly missing 80% of sessions #21610
    2. [BUG] Past conversations not showing in dropdown - sessions-index.json not being updated. #18619
    3. [BUG] Sessions index has wrong path information #20102

    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

    Those are about session's not showing up to resume. This is about messages/context missing from a resumed conversation.

  3. shovel-kun commented on Feb 1, 2026

    @shovel-kun

    Occurs on Arch Linux too

  4. qubitcontracting commented on Feb 3, 2026

    @qubitcontracting

    Quick check to verify you have this bug:

    Linux/macOS/WSL:

    LATEST_INDEX=$(ls -t ~/.claude/projects/*/sessions-index.json | head -1)
    echo "Index: $(jq '.entries[0].messageCount' "$LATEST_INDEX")"
    echo "Actual: $(wc -l < $(ls -t ~/.claude/projects/*/*.jsonl | head -1))"

    Windows PowerShell:

    $latestIndex = Get-ChildItem "$env:USERPROFILE\.claude\projects\*\sessions-index.json" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
    $idx = (Get-Content $latestIndex.FullName | ConvertFrom-Json).entries[0].messageCount
    $actual = (Get-ChildItem "$env:USERPROFILE\.claude\projects\*\*.jsonl" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | Get-Content).Count
    Write-Host "Index: $idx  Actual: $actual"

    If Index is much lower than Actual, you have this bug.


    Confirming across 4 machines (all v2.1.29):

    • Linux (Ubuntu 25.10): Index 4 msgs, Actual 886 lines
    • WSL2 (Ubuntu 25.10): Index 13 msgs, Actual 4,885 lines
    • macOS 26.2 (Build 25C56): Index 2 msgs, Actual 29,048 lines
    • Windows 11 Pro (Build 26200): Index 6 msgs, Actual 55 lines

    Workaround: Create a SessionEnd hook that updates sessions-index.json on exit.

    The fix needs to:

    1. Find the most recent .jsonl session file in each project
    2. Update the matching entry in sessions-index.json with:
      • messageCount = line count of the session file
      • fileMtime = file modification time in milliseconds since epoch
      • modified = current UTC timestamp in ISO format

    You can ask Claude Code to generate this fix for your OS by describing the above requirements.

  5. ByTheSeaL commented on Feb 4, 2026

    @ByTheSeaL

    Exact same issue here: #22960

    Solved by deleting sessions-index.json. downgrading to 2.1..29 and relaunching with "claude /resume". I'll implement the SessionEnd hook next.

    Screenshot of /resume page with bug:

    Image

    And then after fix:

    Image

    Same CC instance, same folder.

  6. bcherny commented on Aug 19, 2026

    @bcherny
    Collaborator

    Thanks for the detailed investigation — the mechanism you identified was real at the time, but it has since been removed.

    What I tried on 2.1.233 (Linux): recreated your setup — a project with a long conversation .jsonl plus a stale sessions-index.json claiming messageCount: 3 and a wrong firstPrompt — then ran claude --resume. The full conversation history was restored (verified with /export); the stale index file is ignored entirely.

    The per-project sessions-index.json cache was replaced in 2.1.30 ("replacing the session index with lightweight stat-based loading and progressive enrichment" — see the changelog), and later releases (2.1.77, 2.1.91, 2.1.108) fixed remaining cases of --resume truncating history. Any leftover sessions-index.json on disk is now inert and safe to delete.

    Note that after resuming, the screen only renders the most recent messages — earlier history is still loaded (Ctrl+O shows the full transcript).

    Closing as fixed — reply here if you still see partial history on a current version and we'll reopen.

    🤖 Generated with Claude Code

  7. github-actions commented on Oct 9, 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.

  8. locked as resolved and limited conversation to collaborators on Oct 9, 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 workinghas reproHas detailed reproduction stepsmemoryplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions