claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Desktop (Windows/MSIX) v2.42304.0 ignores --user-data-dir: second copy hands off to the default instance or opens the default profile

Open onimetal opened this issue 1 month ago • 9 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Since Claude Desktop v2.42304.0 (Windows, Microsoft Store / MSIX build) the app ignores --user-data-dir.

A second copy started with Claude.exe --user-data-dir=<dir>:

  • with the default instance running: hands off to it. No new main process survives even 0.5 s, and the default window (account A) is brought to the front.
  • with no instance running: starts and stays running with --user-data-dir=... on its command line, but the window opens the default profile (account A) instead of <dir>.

This setup worked every day from v2.26454.0 through v2.37337.1, after the v2.26454.0 fix "Fixed Cowork tasks failing to start in a second copy of the app running on the same Windows account." The v2.42304.0 changelog does not mention any change to launch arguments or data folders.

What Should Happen?

A copy started with --user-data-dir=<dir> runs as a separate instance using <dir> (account B), next to the default window (account A), with Cowork working in both, as it did on 2.26454.0 to 2.37337.1.

Error Messages/Logs

No error dialog and no Application event log entries.

Process polling (Win32_Process every 0.5 s for 10 s) after launching the second copy with the default instance running:
t+500ms .. t+10000ms: processes with 'Claude-Second' in the command line = 0
only the default instance (no --user-data-dir) remains

Same launch with no instance running:
process with --user-data-dir=...\Claude-Second stays alive, MainWindowTitle='Claude', but the UI is signed in to the default profile's account.
Nothing in the second data folder (MSIX-virtualized at %LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude-Second) has been written since the update to 2.42304.0.

Steps to Reproduce

  1. Install Claude Desktop 2.42304.0 from the Microsoft Store (MSIX) and sign in normally (default profile, account A).
  2. With it running, run in cmd: start "second" "<InstallLocation>\app\Claude.exe" "--user-data-dir=%APPDATA%\Claude-Second" (<InstallLocation> from (Get-AppxPackage *Claude*).InstallLocation)
  3. Observe: no second process stays alive; the existing window comes to the front.
  4. Quit Claude completely (tray > Quit) and repeat step 2.
  5. Observe: the app opens, but signed in to account A (default profile), not the profile in Claude-Second.

On 2.37337.1 the same steps opened a second, independent window signed in to account B.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Claude Desktop 2.37337.1 (MSIX)

Claude Code Version

Claude Desktop 2.42304.0.0 (Microsoft Store / MSIX)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Probably related:

  • v2.42304.0 changelog: "Fixed the app sometimes starting with no window open, including after restarting from the Help menu on Windows and Linux" (startup path change; nothing about launch arguments).
  • #98613 (Cowork VM ID derived from the user SID only; second instance) and the v2.26454.0 fix quoted above.
  • #98549 (sign-in from a second --user-data-dir instance completes in the first instance) and #18435 (multiple accounts in Desktop).

Ask: please keep honoring --user-data-dir for a second copy, as since 2.26454.0, or provide a supported way to run two accounts side by side on one Windows login.

onimetal avatar Oct 17 '26 20:10 onimetal

I can't believe this isn't a basic feature. I have two accounts for a legitimate reason, to keep the work I do for my employer and the work I do personally separate. I have 2 Max plans. It would be more cost effective and I'd get more usage out of 1 Max x20 plan, but I'm trying to do things properly. It was so fiddly to get this working in the first place and all of a sudden it just stops. Being able to just have two desktop apps open at the same time was great. Being able to quickly switch between profiles would be ok. Having to log out of one and then log into the other one takes ages every time you have to do it (version 2.42304.0, Microsoft Store)

dgreer-gcc avatar Oct 19 '26 01:10 dgreer-gcc

Root cause, from the 2.42304.2 main bundle (Store/MSIX build):

The new user-data move ([user-data-move] in main.log, preference userDataOutsidePackageAnswer) takes its target from LOCALAPPDATA only: %LOCALAPPDATA%\Claude-Data\<package family>. Once the default profile has moved there, that folder exists, so every launch decides use_moved, whatever --user-data-dir set app.getPath("userData") to. It then calls app.setPath("userData", <that folder>) and requestSingleInstanceLock():

  • default instance running: the lock is held, so it reports handedOff and calls app.exit(0) (the hand-off above);
  • nothing running: it gets the lock and runs on the default profile's data (account A).

The move is skipped only for CLAUDE_USER_DATA_DIR (which signed builds delete at startup), 3P mode, UNC-relocated profiles, or a LOCALAPPDATA that looks like a share.

Suggested fix: treat an explicit --user-data-dir like CLAUDE_USER_DATA_DIR and skip the move when userData is not the default location.

Workaround until then: give the second copy the same LOCALAPPDATA written as an extended-length path. It is the same local folder, but the move treats it as a share, logs [user-data-move] stay_target_unavailable and keeps --user-data-dir. Tested on 2.42304.2 with the app execution alias and the profile in %LOCALAPPDATA%:

$local = $env:LOCALAPPDATA
$env:LOCALAPPDATA = "\\?\$local"
Start-Process "$local\Microsoft\WindowsApps\claude-desktop.exe" "--user-data-dir=`"$local\Claude-Second`""
$env:LOCALAPPDATA = $local

One side effect: that instance removes the per-user "Open with" registry entry, because osEntryPoints expects LOCALAPPDATA to start with a drive letter. The default instance writes it back when it starts.

multi-claude 0.1.1 applies this to its profiles.

Environment: Windows 11, Claude Desktop 2.42304.2 (Microsoft Store).

thomasog avatar Oct 19 '26 20:10 thomasog

Confirming this on Claude Desktop v2.42304.2 (Windows, Store/MSIX build). Same symptoms: with no instance running, the second --user-data-dir copy stays alive and writes to its own data folder, but no window opens for it — the default profile's window (or nothing) shows instead. If one instance is already running, the second one exits almost immediately and the existing window comes to front. This used to work fine before a recent update.

Lucie-cyber-star avatar Oct 20 '26 08:10 Lucie-cyber-star

Same problem, but I FOUND A SOLUTION! All three of my profiles are running side by side again, and on a second PC with the same version they never broke. Here's what I found, hope it helps.

What's happening (from reading index.pre.js in 2.42304.2 and the app logs):

  • 2.42304 rolls out a "user-data-move": it moves the default profile out of the package (%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude) to %LOCALAPPDATA%\Claude-Data\claude_pzs8sxrjxfjjc. It's enabled per account: the flag gets latched into preferences.userDataOutsidePackageAnswer, and the move happens on the next start.
  • Once that folder exists, every launch is sent there (log: [user-data-move] already_moved), including copies started with --user-data-dir. That's why the second copy hands off to the running one, or opens the default account.
  • Profiles that live in the real %APPDATA% (not inside the package) are left alone (stay_data_in_roaming). That's why my other PC was fine: there the launcher creates the profile folders before starting Claude, so they live in the real AppData.

The fix (quit Claude fully from the tray, and take a backup first):

  1. Move %LOCALAPPDATA%\Claude-Data\claude_pzs8sxrjxfjjc to %APPDATA%\Claude. Same drive, so it's just a rename.
  2. Delete %LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude. In my case it only contained a .user-data-left.claude_pzs8sxrjxfjjc marker; check that first. Don't keep the marker without step 3: if the target ever disappears, the app treats the profile as lost and moves that empty folder back into Claude-Data.
  3. Create an empty file (not a folder) at %LOCALAPPDATA%\Claude-Data\claude_pzs8sxrjxfjjc. The app then sees the target as occupied and leaves everything where it is (stay_target_occupied in the log).
  4. Recommended: also move your extra profiles from ...\LocalCache\Roaming\<name> to %APPDATA%\<name>. That way they survive an uninstall too, and they don't depend on the blocker file.

PowerShell for steps 1-3. It checks everything first and stops without touching anything if your setup looks different:

$ErrorActionPreference = 'Stop'
$moved   = "$env:LOCALAPPDATA\Claude-Data\claude_pzs8sxrjxfjjc"
$classic = "$env:APPDATA\Claude"
$pkgOld  = "$env:LOCALAPPDATA\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude"
if (Get-Process claude -ErrorAction SilentlyContinue) { throw 'Claude is still running: quit it from the tray first.' }
if (-not (Test-Path -LiteralPath $moved -PathType Container)) { throw "No moved profile at $moved" }
if (Test-Path -LiteralPath $classic) { throw "$classic already exists, stopping to avoid mixing data" }
$extra = Get-ChildItem -LiteralPath $pkgOld -Force -ErrorAction SilentlyContinue | Where-Object Name -ne '.user-data-left.claude_pzs8sxrjxfjjc'
if ($extra) { throw "Old package folder has unexpected content: $($extra.Name -join ', ')" }
Move-Item -LiteralPath $moved -Destination $classic
if (Test-Path -LiteralPath $pkgOld) { Remove-Item -LiteralPath $pkgOld -Recurse -Force }
New-Item -ItemType File -Path $moved | Out-Null

After this, the default profile logs stay_target_occupied and all my instances open their own accounts again. 🎉

Bonus, possibly good news: the app auto-updated to 3.1623.0 while I was testing, and the --user-data-dir instances now log stay_chosen_folder, a reason that didn't exist in 2.42304.2. Looks like a proper fix may be on the way. If anyone is on 3.1623.0 without this workaround, it would be great to hear whether --user-data-dir works again for you.

cyranoidy avatar Oct 20 '26 15:10 cyranoidy

Follow-up on my workaround above: don't use it if you rely on MCP servers. Claude passes LOCALAPPDATA to MCP servers, and npm's realpath fails on every spelling the user-data move treats as a share (\\?\C:\..., \\.\C:\..., //?/C:/..., even \\localhost\C$\...): ELOOP, or "Maximum call stack size exceeded" under npx. So servers started through npx never finish the handshake.

What works on 2.42304.2 instead: point LOCALAPPDATA (for the second copy only) at a real folder that holds a directory junction to each top-level folder of your real LocalAppData, except Claude's own folders (Claude, Claude-*, Claude Nest, AnthropicClaude), and under Packages, except Claude's package. The move finds no Claude-Data\<family> there ([user-data-move] stay_data_location_unknown) and keeps --user-data-dir, while child processes get a normal path that resolves to the usual folders. Claude's own folders have to stay out because it refuses private folders whose last component is a junction.

multi-claude 0.1.4 does this for its profiles.

@cyranoidy thanks for the 3.1623.0 data point. stay_chosen_folder sounds like the proper fix (an explicit --user-data-dir honored); I'll check once it reaches me.

thomasog avatar Oct 20 '26 18:10 thomasog

Thanks for the follow-up, and for the junction approach. Clever way around the LOCALAPPDATA problem!

To avoid confusion for anyone landing here: the workaround I posted is a different one, and it doesn't have that MCP issue.

  • It doesn't change LOCALAPPDATA or use any share-style path. It only moves the profile folders back to the real %APPDATA% and leaves an empty file at %LOCALAPPDATA%\Claude-Data\claude_pzs8sxrjxfjjc. Every child process (MCP servers, Claude Code, etc.) gets the normal environment.
  • Tested after the change on 3.1623.0: my local MCP server starts and works normally.

Some more data points in case they help:

  • On 2.42304.2, right after the change, the default profile logged [user-data-move] stay_target_occupied, and all three instances opened their own accounts side by side.
  • After the auto-update to 3.1623.0, the default profile still logs stay_target_occupied (the blocker file is still there) and the --user-data-dir instances log stay_chosen_folder. So my machine can't tell whether 3.1623.0 alone fixes a setup where the default profile was already moved. Someone without the blocker would need to confirm.
  • Cowork sessions survived the move back. 260 of my 269 session files stored absolute paths under %APPDATA%\Claude, and only 2 had Claude-Data paths. Those two newest sessions now resolve their upload folders under %APPDATA%\Claude as well.
  • Why my second PC never broke on the same version: its launcher (claude-desktop-clone) creates the profile folder before starting Claude. The folder therefore exists in the real %APPDATA%, and the app writes there instead of the package's LocalCache. Profiles outside the package are never moved (stay_data_in_roaming), even with the flag latched on.
  • Tip for launcher scripts: pre-creating the --user-data-dir folder from outside the app keeps that profile out of the package. That doesn't help once the default profile has been moved, though: as long as Claude-Data\claude_pzs8sxrjxfjjc is a folder, every launch goes there. That case needs steps 1-3 from my earlier comment.

Two cautions: keep the blocker file in place (it's 0 bytes, but it's what stops the move), and take a backup before moving anything. All of this relies on undocumented behavior, so it may change in future versions.

cyranoidy avatar Oct 20 '26 21:10 cyranoidy

@cyranoidy, a data point for your open question: on this PC the default profile was already moved (Claude-Data\claude_pzs8sxrjxfjjc is a folder, no blocker file) when it auto-updated to 3.1623.0. With nothing else changed and a normal LOCALAPPDATA, the --user-data-dir instances log [user-data-move] stay_chosen_folder and keep their own folders next to the default one. So 3.1623.0 alone fixes it; the workarounds are only needed on 2.42304.x.

thomasog avatar Oct 22 '26 15:10 thomasog

If you don't need the accounts open side by side, only switching between them: I built a small open source tray tool that swaps the sign-in inside the one Store app and survived the Claude-Data move (since v0.3.2). Your Code chats and projects come along, and it shows usage for all accounts. Windows only for now; the macOS build isn't tested on a real Mac yet. https://github.com/SnlperStripes/claude-account-switcher (I'm the author.)

SnlperStripes avatar Nov 03 '26 18:11 SnlperStripes

This was fixed in Claude Desktop 3.1623.0, so we're closing this issue. If you disagree, let us know here and we can re-open it. Thanks for reporting!

bpasero-ant avatar Nov 29 '26 18:11 bpasero-ant