Windows: sessions lost on restart due to cross-drive EXDEV rename failure

Resolved 💬 2 comments Opened Mar 15, 2026 by bkim346 Closed Mar 16, 2026

Bug

On Windows, if AppData/Roaming is on a different drive than TEMP, all Claude Desktop sessions disappear from the sidebar on every restart.

Root Cause

The app writes session files as .json.tmp (using the system temp directory), then calls rename() to move them to the final .json path under AppData/Roaming/Claude/claude-code-sessions/. On Windows, rename() fails with EXDEV: cross-device link not permitted when source and destination are on different volumes.

The .json.tmp files are written successfully, but the final .json files never get created. Sessions work in-memory during the current app session but are lost on restart since only .json files are loaded.

Log evidence

[error] Failed to save session local_8c7405a5-...: EXDEV: cross-device link not permitted,
  rename 'C:\Users\...\local_8c7405a5-....json.tmp' -> 'C:\Users\...\local_8c7405a5-....json'

This repeats for every session save attempt.

Environment

  • Windows 11
  • TEMP on C: drive
  • AppData/Roaming on D: drive (not a symlink/junction — actual different volume)

Fix

Use copy + delete (or fs.copyFile + fs.unlink) instead of fs.rename() as a fallback when rename() fails with EXDEV. This is a well-known Node.js pattern — for example, fs-extra's move() handles this automatically.

Workaround

find "$SESSION_DIR" -name "*.json.tmp" | while read -r tmpfile; do
  target="${tmpfile%.tmp}"
  cp "$tmpfile" "$target"
done

View original on GitHub ↗

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