[BUG] MSIX: Code sessions lost on restart — EXDEV error in session save (fs.rename across VFS reparse point)

Resolved 💬 4 comments Opened Apr 12, 2026 by FelipeJackFox Closed May 23, 2026

Bug description

Code sessions in Claude Desktop disappear from the sidebar after every restart or app update. Sessions work fine during the current run but are gone when Desktop is reopened.

Environment: Windows 11, Claude Desktop 1.1617.0 (MSIX package)

Root cause: EXDEV on MSIX — fs.rename() fails across VFS reparse point

On Windows, Claude Desktop is installed as an MSIX package (Claude_pzs8sxrjxfjjc). The %APPDATA%\Claude path is a VFS reparse point that resolves to D:\WpSystem\<SID>\...\LocalCache\Roaming\Claude — a different drive letter than C:.

When Desktop saves Code session metadata, it uses the standard atomic write pattern: write to .json.tmp, then fs.rename('.json.tmp', '.json'). The rename fails with EXDEV: cross-device link not permitted because the OS sees the VFS reparse as a cross-device operation.

From main.log (first occurrence, day 1 of install):

[error] Failed to save session local_c6493c1e-...: EXDEV: cross-device link not permitted, 
  rename '...claude-code-sessions\...\local_c6493c1e-....json.tmp' 
      -> '...claude-code-sessions\...\local_c6493c1e-....json'

3,796 EXDEV errors in my log since March 25. Every single session save fails. Sessions stay as .json.tmp and are never finalized to .json, so they're lost on restart.

How we found it

We initially assumed the issue was LevelDB — wrote a script to inject LSS-cc-* keys directly into Local Storage/leveldb. That didn't work: Desktop cleans up unrecognized keys on restart during compaction.

Then we checked main.log and found thousands of EXDEV errors. The .json.tmp.json rename was failing silently from the user's perspective (no UI error), but every session save was broken.

Proof that the fix pattern already exists in the codebase

Interestingly, the marketplaceFileOps module already handles EXDEV with a fallback:

[warn] [marketplaceFileOps] rename(...manifest.json.tmp → ...manifest.json) failed (EXDEV), 
  falling back to direct write

The session save code just needs the same fallback: catch EXDEV, fall back to fs.copyFile() + fs.unlink() (or direct write).

Workaround

A simple script that copies .json.tmp.json while Desktop is closed restores all sessions:

// For each local_*.json.tmp without a corresponding .json:
await fs.copyFile(tmpPath, jsonPath);  // copyFile works cross-device, rename doesn't

After running this, Desktop loads all sessions normally on next start. But new sessions will hit the same EXDEV error, so the script needs to be re-run periodically.

Suggested fix

Apply the same EXDEV fallback from marketplaceFileOps to the session save code path:

try {
  await fs.rename(tmpPath, finalPath);
} catch (err) {
  if (err.code === 'EXDEV') {
    await fs.copyFile(tmpPath, finalPath);
    await fs.unlink(tmpPath);
  } else {
    throw err;
  }
}

This would fix it for all MSIX installations where the VFS reparse point crosses drive letters.

Related closed issues

  • #29172 — Sessions disappear after restart
  • #29373 — Update loses history in directory migration
  • #25579 — MSIX uses wrong userData path
  • #26758 — MSIX VFS breaks Cowork streaming
  • #31787 — Sessions disappear (VS Code + Desktop conflict)

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗