claude-code - 💡(How to fix) Fix Pinned sessions silently wiped to empty array in desktop app [1 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#54806Fetched 2026-04-30 06:35:26
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Author
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Previously pinned sessions in the Claude Code desktop app sidebar disappeared without any user action. Pin state in the Electron LevelDB (~/Library/Application Support/Claude/Local Storage/leveldb/) shows "pinnedOrder":[] — empty.

Root Cause

The asymmetry between durable session metadata and ephemeral pin state is the root cause.

RAW_BUFFERClick to expand / collapse

Summary

Previously pinned sessions in the Claude Code desktop app sidebar disappeared without any user action. Pin state in the Electron LevelDB (~/Library/Application Support/Claude/Local Storage/leveldb/) shows "pinnedOrder":[] — empty.

Environment

  • Claude Code desktop app version: 2.1.121
  • Entrypoint: claude-desktop
  • macOS: 26.4.1 (build 25E253), Apple Silicon

What happened

Multiple sessions were previously pinned in the sidebar. After what was likely an app update or restart, all pins were gone. Sessions and transcripts themselves are intact — only the pin state was lost.

Investigation

Pin state appears to live exclusively in the Electron app's LevelDB local storage:

  • Path: ~/Library/Application Support/Claude/Local Storage/leveldb/
  • Key fragment found: "pinnedOrder":[],"groupBy..." (empty array)
  • The two most recent .ldb files (017577.ldb dated Apr 29 15:17, 017580.ldb dated Apr 29 15:28) both show pinnedOrder as [].
  • The oldest extant .ldb (017327.ldb dated Apr 26) contains no pinnedOrder data at all — LevelDB compaction has already discarded the previous state.
  • Per-session JSON files at ~/Library/Application Support/Claude/claude-code-sessions/<account>/<workspace>/local_*.json contain isArchived, title, model, etc. — but no pin field. So pin state is not duplicated to durable per-session storage.

Why this is a bug

  1. No redundancy: Pin state lives in a single Electron LevelDB key. A migration, a corrupt write, or a compaction loss wipes it permanently with no recovery path.
  2. Silent failure: No warning, no fallback, no log message visible to the user.
  3. No backup or sync: Pins do not appear to sync across machines or persist through app updates.

Suggested fix

Persist isPinned: true (and a pinnedAt timestamp for ordering) on each session's JSON metadata file alongside isArchived. The sidebar can derive pinnedOrder from those, with the LevelDB key acting only as a UI cache rather than the source of truth.

Reproduction

Not directly reproducible without the triggering event, but trivially observable:

  1. Pin one or more sessions.
  2. strings "~/Library/Application Support/Claude/Local Storage/leveldb/"*.ldb | grep pinnedOrder — you will find the array.
  3. Compare to per-session JSON in claude-code-sessions/ — no pin field exists there.

The asymmetry between durable session metadata and ephemeral pin state is the root cause.

extent analysis

TL;DR

Update the session's JSON metadata file to include a isPinned field and use it as the source of truth for pinned sessions, rather than relying solely on the Electron LevelDB key.

Guidance

  • Verify that the pinnedOrder key in the LevelDB storage is being updated correctly when a session is pinned or unpinned.
  • Consider adding a backup or sync mechanism for pinned sessions to prevent data loss in case of a LevelDB corruption or compaction issue.
  • Update the code to derive the pinnedOrder from the session's JSON metadata files, using the isPinned field as the source of truth.
  • Test the updated code to ensure that pinned sessions are correctly persisted and displayed in the sidebar.

Example

// Example session JSON metadata file
{
  "isArchived": false,
  "title": "Example Session",
  "model": "example-model",
  "isPinned": true,
  "pinnedAt": "2023-04-29T15:17:00.000Z"
}

Notes

The suggested fix requires updating the code to persist the isPinned field in the session's JSON metadata file and using it to derive the pinnedOrder. This change should prevent data loss due to LevelDB corruption or compaction issues.

Recommendation

Apply the workaround by updating the session's JSON metadata file to include the isPinned field and using it as the source of truth for pinned sessions. This will provide a more robust and reliable way to store and display pinned sessions.

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