sessions-index.json not updated, causing `claude --resume` to show stale/missing sessions
Bug Description
claude --resume only shows a random smattering of old sessions (from ~2 weeks ago), despite having run many sessions recently. The session data itself is being saved correctly — the .jsonl files are all present on disk — but they don't appear in the resume picker.
Root Cause (identified with Claude's help)
The sessions-index.json files in ~/.claude/projects/ are either:
- Missing entirely for many active project directories
- Stale — not being updated when new sessions are created
For example, on my system (v2.1.39, macOS):
- 11 out of 18 project directories have no
sessions-index.jsonat all, including directories with very recent session activity - The index files that do exist haven't been updated since late January, despite session
.jsonlfiles being written as recently as today
HAS INDEX: -Users-...-dev-ozzydb (Feb 4) ← stale, sessions exist from Feb 10
NO INDEX: -Users-...-dev-rileyviewer ← no index, 20MB+ session from Feb 10
NO INDEX: -Users-...-dev ← no index, sessions from Feb 10
NO INDEX: -Users-...-hard-saptest1 ← no index, sessions from Feb 10
The session .jsonl files are all intact — data is not being lost. But since --resume appears to read from sessions-index.json, these sessions are invisible to the resume picker (both CLI and VS Code extension).
Steps to Reproduce
- Run several Claude Code sessions across different project directories
- Close them (I typically just close the terminal)
- Run
claude --resume— only old sessions appear - Check
~/.claude/projects/*/sessions-index.json— many are missing or stale - Check for
.jsonlfiles — they exist and are recent
Expected Behavior
claude --resume should list all recent sessions, and sessions-index.json should be updated whenever a session is created or modified.
Environment
- Claude Code version: 2.1.39
- OS: macOS (Darwin 25.1.0)
- Sessions are closed by closing the terminal (no explicit exit command)
Notes
I found this bug myself; Claude helped identify the specific root cause (the stale/missing index files) by examining the session storage on disk.
Showing cached comments. Read the full discussion on GitHub ↗
14 Comments
Additional finding: The local usage tracking at
~/.claude/usage-data/appears to have the same problem. Both thereport.htmland per-session facet JSONs stopped being updated on Feb 4, despite active sessions running through Feb 10-11. This suggests it may be a broader issue with local metadata/index writes, not justsessions-index.json.Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Confirmed: Same issue here (macOS)
Can confirm this bug on macOS with similar findings:
Environment
Findings
Session indexing completely stopped on: February 4, 2026 at 00:33 UTC
sessions-index.jsonfiles.jsonlfilesExample from one project:
Empty Summaries Also Present
Some indexed sessions (created before Feb 4) have empty summaries:
This suggests two separate issues:
Potential Connection to #16157
The timeline aligns suspiciously with the usage quota bug (#16157):
Session summary generation requires API calls (potentially 100K+ input tokens per session × all users). Disabling this would significantly reduce token consumption, which may have been an emergency response to the usage crisis.
Whether this was intentional cost-cutting or an unintended side effect of the late-January changes is unclear, but the timing is too coincidental to ignore.
I can confirm this issue on Linux (Ubuntu, Claude Code 2.1.41).
Findings:
sessions-index.jsonhas 28 entries, with the newest modified date being January 23, 2026.jsonlsession files on disk, including many from February 10-13/resumepicker (presumably from the.jsonlfiles), but clicking on them gives "Session was not found" because the index lookup failsWorkaround:
I wrote a Python script that parses all
.jsonlfiles on disk and rebuilds the missing entries insessions-index.json— extractingfirstPrompt,customTitle,messageCount, timestamps, etc. from the raw session data. After running it,/resumeworks again for all sessions.Happy to share the script if anyone needs it.
Environment:
cleanupPeriodDays: 3650Here's the repair script I mentioned: https://gist.github.com/tirufege/0720c288092c1a3a4750f7c198aa524b
It scans all
.jsonlsession files on disk, extracts metadata (first prompt, custom title, message count, timestamps), and adds missing entries tosessions-index.json. Creates a.bakbackup before writing.This issue is tracked in the consolidated report at #26123, which identifies 3 distinct root causes (index writes stopped Feb 4, picker hardcoded to 10-session batch, Windows worktree case-sensitivity) with source-level analysis and a one-line fix. Please add your thumbs-up there to help it reach the oncall triage threshold.
Your 👍 on the consolidated issue matters. Based on how this repo's automated triage works, issues need 50+ combined reactions and comments to trigger the oncall label — the only way a human at Anthropic actually reviews it. Right now the engagement is split across 12+ duplicate issues and none will ever hit that threshold alone.
The consolidated issue with full root cause analysis (3 bugs identified, one-line fix included) is here: #26123
Please go add your 👍 there. That's the single most useful thing you can do to get this fixed.
We're at 22 👍 on the consolidated issue — more than halfway to the 50 needed to get a human at Anthropic to look at this. Every thumbs-up on a duplicate issue is a thumbs-up that doesn't count. The automated triage bot only checks individual issues, not the cluster.
Please take 5 seconds to 👍 here: #26123
The root causes are fully identified, a one-line fix exists, and community repair scripts are available. The only thing missing is enough engagement on a single issue to cross the oncall threshold. We can get this fixed if we stop splitting our votes across 12 separate reports.
Status Update: This is fixed in v2.1.50
After investigating the compiled binary and CHANGELOG, here's what happened and the current state:
The
sessions-index.jsonwas intentionally removedIn v2.1.30, the session index file was replaced with direct filesystem scanning — the
--resumepicker now discovers sessions by stat-ing.jsonlfiles on disk instead of maintaining a centralized index. This reduced memory usage by 68%.The string
sessions-indexdoes not exist anywhere in the v2.1.50 binary. The stale/missing index files on disk are harmless leftovers — the CLI no longer reads or writes them.Multiple bugs in the new stat-based system caused the reported behavior
| Bug | Fixed In | Issue |
|-----|----------|-------|
| Resume picker only loaded 10 sessions initially (most sessions invisible) | v2.1.47 | #26123 |
| Sessions with >16KB first messages silently dropped from list | v2.1.47 | #25721, #25920, #26140 |
| Symlink path resolution mismatch made sessions invisible | v2.1.50 | — |
| Session data loss on SSH/terminal disconnect (data not flushed before shutdown) | v2.1.50 | — |
How
--resumeworks now (v2.1.50).jsonlfiles viareaddirSync+statSyncAction items
sessions-index.jsonfiles can be safely deleted — they're no longer used🤖 Generated with Claude Code
Custom Names Broken Too — Feb 23, 2026
Adding another dimension to this: even sessions that DO appear in the picker don't show their custom names.
I have 6 concurrent sessions, all renamed via
/rename. Terminal tab titles show the correct names. The Ctrl+E picker shows auto-generated summaries for every single one.The index staleness (#26123 Bug 1) was supposedly addressed by direct
.jsonlscanning in v2.1.47, but custom names set via/renameare stored in the JSONL and the picker apparently never reads them back.The combination is brutal:
This is a daily-driver workflow blocker. Day 5 reporting.
Version: Claude Code latest, Bun v1.3.10, Windows 11
Related: #25090, #26123, #24729
Hey! I ran into a similar pattern in our bug knowledge base and thought this might help.
What's happening: Regression in Claude Code ~v2.1.x (around Feb 4 2026) broke the session-index writer. Session .jsonl files are still written but sessions-index.json is no longer updated on session create/end. The index writer likely fails silently (swallowed error or dead code path after refactor).
What worked for us:
Rebuild all sessions-index.json files from existing .jsonl session data on disk. Run this one-liner to regenerate every project's index. For the permanent fix, Anthropic needs to patch the index writer in the CLI source.
Hope this helps! Let me know if it doesn't match your case — happy to dig deeper. 🦞
---
<sub>🦞 Confucius Debug — community knowledge base for AI agent bugs. Free to search via MCP.</sub>
Confirming on macOS — Claude Code v2.1.63
Same issue here.
sessions-index.jsonsilently stopped updating on February 3, 2026 and has not recovered since.Environment
Diagnostics
The
sessions-index.jsonstructure looks correct (version 1, proper entries with sessionId/fullPath/fileMtime/firstPrompt etc.), but new sessions simply aren't being appended. All JSONL files are valid JSON, proper permissions (-rw-------), and contain intact user/assistant message chains.Impact
claude --resumein terminal works correctly — it reads directly from disk, bypassing the indexWorkaround
claude --resume(CLI) correctly lists all sessions since it appears to scan.jsonlfiles directly rather than relying on the index. The VS Code "Past Conversations" picker remains broken.FYI the
sessions-index.jsonapproach here is moot on current versions (removed in v2.1.30), but the problem persists. I did a fresh investigation on v2.1.81 in #38340. Even with the stat-based replacement, the picker still doesn't scan for.jsonlfiles. Confirmed viastraceand by manually creating a valid session file that the picker never discovered.Stale
sessions-index.json— 14 projects drifting up to 93 days on one machine, hypothesized mechanismHit this on WSL2, v2.1.118, single-OS (not the cross-platform fragmentation from #17682 / #9668 / #9306). Posting because the cumulative-drift evidence and the mechanism hypothesis tying graceful-shutdown dependency to overwrite-of-cached-state don't appear to be in the thread yet.
Environment
~/.local/share/claude/versions/2.1.118)~/.claude/projects/bucket per project — not cross-OS-dual-encoded for the projects showing driftSymptom
/resumepicker reports one of my active sessions as a 9-message stub last modified 2026-01-09, with summary "OpenCode permissions setup and Terminal Workspaces bug fix."Actual state of the
.jsonl:.jsonlappend: 2026-04-23 02:22 UTC (the current session I was in when I opened the picker)The
.jsonlcontent is clean and picker-loadable viaclaude -r <uuid>(bypass the picker). The index is the only broken artifact.Cumulative drift — 14 projects on this machine
Scan of
~/.claude/projects/*/on 2026-04-23, flagging projects wheresessions-index.jsonmtime lags the newest non-subagent.jsonlmtime by more than 7 days:| Project (tail of encoded name) | Lag |
|---|---|
|
-mnt-d-MEDIA| 93d ||
home-assistant-projects| 90d ||
…tasknotes…obsidian-plugins-tasknotes(duplicate-encoded) | 84d ||
…tasknotes-enhancements| 80d ||
cynario| 79d ||
retake-studio| 66d ||
4-VAULTS| 65d ||
…terminal-workspaces| 57d ||
b-g-33---Home-Lab--Home-Server| 57d ||
b-g-15---Family-Planning--Parenthood| 46d ||
3d-printing| 44d ||
b-g-vault-b-g,…tasknotes…plugins-tasknotes(dot-prefix variant) | 12d each ||
DFD-Excalidraw-System| 11d |This rules out one-time WSL crash. It's consistent with every ungraceful close dropping an index update, accumulating across months of normal WSL lifecycle (window-close without typing
/exit,wsl --shutdown, machine suspend, OOM-kill).Mechanism hypothesis — graceful-shutdown is necessary but not sufficient
atexit— index update is lost,.jsonlsurvives because it's append-on-write.xain the minifiedcli.js). Other commenters confirm the bug triggers without worktrees too, which is what I observed.So the fuller mechanism is likely: the write path is both racy against forced-kill AND regresses state on some graceful closures, because it re-reads a cached snapshot rather than merging with reality.
sessions-index.jsonformat (as observed — this is not documented publicly)Fully undocumented in docs.anthropic.com / docs.claude.com. It would help third parties considerably if the schema were published, even as a footnote.
Workaround landscape (no Anthropic fix required to use these, but none should need to exist)
Third-party tools converging on two shapes:
pconv rebuild-indexwith atomic writes, dated backup, and adoctorcounterpart for read-only detection. Round-trip tested against the schema above —pconv rebuild-index --allfollowed bypconv doctorreports zero stale projects..jsonls directly and ignore the index.Asks for Anthropic
Prioritized:
sessions-index.jsonis missing OR lags the newest.jsonlin the same dir by >24h, regenerate it from the.jsonls before showing the picker. Cheap (<100 ms for the largest project I have; likely faster than what the picker already does).sessions-index.jsonformat publicly. Footnote-length; enables the third-party ecosystem to operate on stable ground rather than reverse-engineering per-version./resumewhen picker results disagree with.jsonlmtimes by more than N days. Even without an auto-fix, a hint like "the picker may be stale; consider runningclaude --rebuild-indexorpconv rebuild-index" would close the feedback loop for users.Reproducibility hints for whoever picks this up
strace -fe trace=openat,rename,write,fsync -p $(pgrep -f claude)through a session, then diff index state across/exitvswsl --shutdownvs SIGKILL, would pin the write cadence. I haven't done this myself becauseclaude -r <uuid>andpconv rebuild-indexunblock me today; but the drift pattern I report above is strongly suggestive of the hypothesis above.---
References:
xa), #41946 (clean-exit failures), #44346 (WSL2-specific), #38340 (picker does not filesystem-scan in v2.1.81)