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

Status Fixed / completed
Maintainer reply None cached
Activity 6 comments · opened Jan 30, 2026 · closed Aug 19, 2026

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.

View original on GitHub ↗

5 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/21610
  2. https://github.com/anthropics/claude-code/issues/18619
  3. https://github.com/anthropics/claude-code/issues/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

tamasarpad · 7 months ago
Found 3 possible duplicate issues: 1. [[BUG] /resume index suddenly missing 80% of sessions #21610](https://github.com/anthropics/claude-code/issues/21610) 2. [[BUG] Past conversations not showing in dropdown - sessions-index.json not being updated. #18619](https://github.com/anthropics/claude-code/issues/18619) 3. [[BUG] Sessions index has wrong path information #20102](https://github.com/anthropics/claude-code/issues/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.

shovel-kun · 7 months ago

Occurs on Arch Linux too

qubitcontracting · 6 months ago

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.

ByTheSeaL · 6 months ago

Exact same issue here: https://github.com/anthropics/claude-code/issues/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:

<img width="1732" height="575" alt="Image" src="https://github.com/user-attachments/assets/42a7fd9a-502d-4e5b-8192-d1c51613287b" />

And then after fix:

<img width="1811" height="956" alt="Image" src="https://github.com/user-attachments/assets/6df5f562-ef11-4e0d-aead-e76f7f1c5e93" />

Same CC instance, same folder.

Showing cached comments. Read the full discussion on GitHub ↗