claude-code - 💡(How to fix) Fix [BUG] Claude Desktop Code sessions fail to persist on Windows MSIX - EXDEV cross-device link error [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#54883Fetched 2026-05-01 05:51:55
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

Error Message

Error: EXDEV: cross-device link not permitted, rename '...\session.json.tmp' -> '...\session.json'

Root Cause

Root Cause Analysis

Fix Action

Workaround

Manual workaround (not practical for regular use):

  1. Locate physical storage path: D:\WpSystem\...\Claude-3p\claude-code-sessions\...
  2. Rename all .json.tmp files to .json manually
  3. Restart Claude Desktop

Code Example

Error: EXDEV: cross-device link not permitted, rename '...\session.json.tmp' -> '...\session.json'

---

2026-04-30 11:38:09 [error] Failed to save session local_e9dec550-f8f4-41a6-8d79-ed3f128db6cd: EXDEV: cross-device link not permitted
2026-04-30 11:38:43 [info] Loaded 0 persisted sessions from C:\Users\55438\AppData\Roaming\Claude-3p\claude-code-sessions\...

---

-rw-r--r-- 1 55438 197609 668 Apr 29 11:46 local_xxx.json.tmp
-rw-r--r-- 1 55438 197609 531 Apr 29 18:51 local_yyy.json.tmp

---

// Current problematic approach:
await fs.writeFile(tmpPath, data);
await fs.rename(tmpPath, finalPath);  // Fails with EXDEV on MSIX

// Suggested fix:
await fs.writeFile(finalPath, data);  // Direct write works on MSIX

---

await fs.copyFile(tmpPath, finalPath);
await fs.unlink(tmpPath);
RAW_BUFFERClick to expand / collapse

Bug Description

Claude Desktop Code sessions fail to persist on Windows due to MSIX filesystem virtualization causing atomic write operations to fail with EXDEV: cross-device link not permitted error.

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Claude Desktop Version: 1.4758.0.0 (MSIX from Microsoft Store)
  • Package Family: Claude_pzs8sxrjxfjjc
  • Deployment Mode: 3P (gateway provider)

Root Cause Analysis

MSIX Filesystem Virtualization Conflict

Claude Desktop uses atomic write pattern for session persistence:

  1. Write session data to .json.tmp file
  2. Rename .json.tmp.json (atomic operation)

However, Windows MSIX filesystem virtualization redirects:

  • Virtual path: C:\Users\{user}\AppData\Roaming\Claude-3p\
  • Physical path: D:\WpSystem\{user_sid}\...\LocalCache\Roaming\Claude-3p\

When the application calls fs.promises.rename(), Windows treats this as a cross-device operation because the virtual path appears to be on drive C: while the actual storage is on drive D:. This triggers:

Error: EXDEV: cross-device link not permitted, rename '...\session.json.tmp' -> '...\session.json'

Evidence from Logs

2026-04-30 11:38:09 [error] Failed to save session local_e9dec550-f8f4-41a6-8d79-ed3f128db6cd: EXDEV: cross-device link not permitted
2026-04-30 11:38:43 [info] Loaded 0 persisted sessions from C:\Users\55438\AppData\Roaming\Claude-3p\claude-code-sessions\...

Physical directory only contains .tmp files, no .json files:

-rw-r--r-- 1 55438 197609 668 Apr 29 11:46 local_xxx.json.tmp
-rw-r--r-- 1 55438 197609 531 Apr 29 18:51 local_yyy.json.tmp

Impact

  • All Claude Code sessions within Claude Desktop are lost after app restart
  • Cowork Mode sessions also affected (they use different storage path but same atomic write pattern)
  • Users lose work context, conversation history, and project-specific configurations

Suggested Fix

Replace atomic rename pattern with direct write in MSIX environments:

// Current problematic approach:
await fs.writeFile(tmpPath, data);
await fs.rename(tmpPath, finalPath);  // Fails with EXDEV on MSIX

// Suggested fix:
await fs.writeFile(finalPath, data);  // Direct write works on MSIX

Alternatively, detect MSIX environment and use copy + delete instead of rename:

await fs.copyFile(tmpPath, finalPath);
await fs.unlink(tmpPath);

Related Issues

This is similar to issues reported in other Electron apps running as MSIX packages on Windows. The filesystem virtualization layer does not properly handle rename operations within the virtualized directory.

Workaround

Manual workaround (not practical for regular use):

  1. Locate physical storage path: D:\WpSystem\...\Claude-3p\claude-code-sessions\...
  2. Rename all .json.tmp files to .json manually
  3. Restart Claude Desktop

extent analysis

TL;DR

Replace the atomic rename pattern with a direct write or copy + delete approach to resolve the EXDEV: cross-device link not permitted error in MSIX environments.

Guidance

  • Identify if the application is running in an MSIX environment to determine the best approach for handling file writes.
  • Consider using fs.writeFile(finalPath, data) for direct writes, which should work on MSIX without issues.
  • As an alternative, detect the MSIX environment and use fs.copyFile(tmpPath, finalPath) followed by fs.unlink(tmpPath) to achieve the desired file replacement.
  • Verify the fix by checking that session data is correctly persisted after application restart.

Example

// Direct write approach
await fs.writeFile(finalPath, data);

// Copy + delete approach for MSIX detection
if (isMSIXEnvironment()) {
  await fs.copyFile(tmpPath, finalPath);
  await fs.unlink(tmpPath);
} else {
  await fs.rename(tmpPath, finalPath);
}

Notes

The provided fix assumes that the fs module is being used for file operations. The isMSIXEnvironment() function is not defined in the issue and would need to be implemented based on the specific requirements of the application.

Recommendation

Apply the workaround by replacing the atomic rename pattern with a direct write or copy + delete approach, as this directly addresses the root cause of the issue related to MSIX filesystem virtualization.

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

claude-code - 💡(How to fix) Fix [BUG] Claude Desktop Code sessions fail to persist on Windows MSIX - EXDEV cross-device link error [1 comments, 2 participants]