claude-code - 💡(How to fix) Fix Session picker shows 0-message sessions (empty preview) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48544Fetched 2026-04-16 06:57:12
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2closed ×1
RAW_BUFFERClick to expand / collapse

Problem

The session picker displays sessions with 0 messages. These show an empty preview pane, which is confusing — they look like broken versions of real sessions.

How to reproduce:

  1. Use isolation: "worktree" agents heavily (or have worktree-on-edit enabled)
  2. Worktrees get cleaned up after completion, but their project directories persist in ~/.claude/projects/ with empty/near-empty session files
  3. Open session picker and search — ghost sessions appear alongside real ones with the same name but 0 messages and no preview

Screenshots:

Working session (273 messages, preview visible): The real session under kaufmann-health shows messages and a useful preview.

Broken session (0 messages, empty preview): The same session name appears under kaufmann-health--claude-worktrees-fix-noshow-detection with 0 messages and a completely empty preview pane.

In my case, 113 worktree project directories accumulated in ~/.claude/projects/, 110 of which are completely empty and 3 have orphaned 0-message session files.

Proposed fix

Filter sessions with 0 messages from the session picker. These are never resumable and provide no value. This is a safe filter — a session with 0 messages was either never used or is an artifact of worktree cleanup.

This avoids needing to change worktree lifecycle management and cleanly solves the UX problem (empty previews, duplicate-looking entries in search results).

extent analysis

TL;DR

Filtering sessions with 0 messages from the session picker is the most likely fix to resolve the issue of ghost sessions appearing with empty previews.

Guidance

  • Identify and filter out sessions with 0 messages in the session picker to prevent them from being displayed.
  • Verify that the filter is working correctly by checking that sessions with 0 messages no longer appear in the session picker.
  • Consider implementing a cleanup mechanism to remove empty session files and project directories from ~/.claude/projects/ to prevent accumulation.
  • Review the worktree lifecycle management to understand why empty session files are being created and persisted.

Example

No code snippet is provided as the issue does not contain sufficient information about the implementation details.

Notes

This solution assumes that sessions with 0 messages are not resumable and provide no value, as stated in the proposed fix. However, it is unclear what other implications this filter may have on the overall functionality of the application.

Recommendation

Apply the workaround of filtering sessions with 0 messages from the session picker, as it is a safe and straightforward solution that addresses the immediate UX problem without requiring changes to the worktree lifecycle management.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING