[BUG] Local agent mode: session resume fails with EINVAL on every second message — 435-char transcript path exceeds MAX_PATH (Windows MSIX)

Status Open
Reported on v2.1.142
Maintainer reply None cached
Activity 0 comments · opened Jul 30, 2026

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?

On the Windows MSIX build of Claude Desktop, resuming a local agent
session fails 100% of the time. The first message in any conversation
succeeds; every subsequent message fails with "Failed to resume
session: EINVAL: invalid argument, stat" followed by the path shown in
the Error Messages section below.

The user sees "Something went wrong / Try sending your message again."
Retrying never succeeds.

Root cause appears to be path construction. The desktop app spawns the
bundled CLI with these two values, where SESSION, ACCOUNT and SID are
all GUIDs:

cwd = ...\local-agent-mode-sessions\SESSION\ACCOUNT\local_SID\outputs
CLAUDE_CONFIG_DIR = the same path, but ending in a subdirectory named
".claude" instead of "outputs"

The CLI then resolves the transcript to:

CLAUDE_CONFIG_DIR + \projects\ENCODED_CWD\UUID.jsonl

ENCODED_CWD is the cwd flattened into a single directory name, with
non-alphanumeric characters replaced by hyphens. This embeds the full
session path a second time, producing:

CLAUDE_CONFIG_DIR: 191 characters
ENCODED_CWD name: 191 characters (a single path component)
final path: 435 characters

Windows MAX_PATH is 260. Because every variable component is a GUID,
the length is constant. I measured 15 distinct failing paths and all
15 were exactly 435 characters. This is arithmetic, not environment:
even a 1-character username lands around 428.

Evidence from main.log spanning the full install life (2026-05-18 to
2026-07-29, 70,403 lines):

24 local agent sessions initialized
17 had a failed turn
0 successful resumes, ever
First failure 2026-05-19 12:25, the day after a clean install
Persists across 22 desktop versions (1.7196.1 to 1.24012.9)
and 16 runtime versions (2.1.142 to 2.1.219)

The 7 sessions that did not fail were single-message conversations
where no resume was attempted.

Ruled out: set LongPathsEnabled = 1 under
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem and rebooted, with no
change, consistent with the Electron build not being manifest
long-path aware. Also cleared all stale session data, pre-created the
claude-code-sessions directory, confirmed no CLAUDE_CONFIG_DIR
user or machine environment override, and confirmed both shell and
runtime current. No stale state involved: failures began one day after
a clean install and have never stopped.

Note on MSIX: the path in the error is the un-redirected virtual path.
Actual storage is under
%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude
which is 47 characters longer, at 482 total. So the path is over the
limit either way. This may be the same path-string generator reported
in #58421.

What Should Happen?

Sending a second message in a conversation that used local agent mode
should resume the existing session and continue normally.

The transcript path should be constructed to stay within Windows
MAX_PATH — e.g. by hashing or truncating the encoded-cwd component
rather than embedding the full absolute session path a second time
inside a path that is already 191 characters, and/or by using the Windows long-path prefix (backslash backslash question-mark backslash) for filesystem calls.

Error Messages/Logs

2026-07-29 15:48:17 [warn] [HostLoop] cli.js stderr: Failed to resume session: EINVAL: invalid argument, stat 'C:\Users\<user6c>\AppData\Roaming\Claude\local-agent-mode-sessions\e571089b-1792-4bb3-952c-e5337c85bf7e\aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\local_40ddd21b-1649-4005-a160-6579980a6ce8\.claude\projects\C--Users-<user6c>-AppData-Roaming-Claude-local-agent-mode-sessions-e571089b-1792-4bb3-952c-e5337c85bf7e-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee-local-40ddd21b-1649-4005-a160-6579980a6ce8-outputs\b10c6267-98ab-4769-a4ff-0bf463a87a70.jsonl'

Account GUID and username redacted; placeholders are the same length
as the originals. Actual username is 8 characters, giving 435 total.

Failures by date (single continuous log, never rotated):
  2026-05-19, 05-21, 05-26, 07-15, 07-20, 07-21, 07-23, 07-29

Occurrence counts in log:
  "Failed to resume"           102
  "EINVAL"                     102
  "Cannot save session"          0
  "storage path not available"   0
  successful resumes             0

Steps to Reproduce

  1. Install Claude Desktop on Windows 11 from the MSIX package

(Claude_pzs8sxrjxfjjc), signed in to a Team plan account.

  1. Open a new regular chat (not the Code or Cowork tab).
  2. Ask Claude to create a file — e.g. "create a markdown file

summarizing the following: ..." — so that local agent mode
engages and an outputs\ working directory is created.

  1. Let the first turn complete. It succeeds and the file is produced.
  2. Send any second message in the same conversation — e.g.

"add a section on X".

  1. The turn fails with "Something went wrong". main.log records

"Failed to resume session: EINVAL: invalid argument, stat '...'"
with a 435-character path.

Reproduces on every conversation. 17 of 17 sessions that reached a
second message failed. There is no known combination of settings,
cleanup, or reinstall that avoids it.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

N/A — never worked on this install

Claude Code Version

2.1.219

Platform

Other

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Environment
Claude Desktop (MSIX): 1.24012.9.0
Claude Code runtime: 2.1.219
Windows 11: build 26200.8875
Package family: Claude_pzs8sxrjxfjjc
Plan: Team

Not run from a terminal — the CLI is spawned by Claude Desktop in
local agent mode, so the Terminal/Shell field above is not applicable.

Related issues

#58421 — same path-string generator emitting un-redirected
AppData\Roaming\Claude\local-agent-mode-sessions paths on MSIX
Windows. Reported there as cosmetic (paths users can't navigate to).
This report is the functional failure of the same generator: the app
calls stat() on one of those paths and it fails.

#30655 — Cowork on Windows: orphaned VM process blocks all resume
attempts. Different failure signature (RPC / sdk-daemon errors rather
than a filesystem error), so not a duplicate — listed because it
establishes resume-blocking defects on Windows Cowork as an existing
pattern.

#57498 / #45507 — local agent mode leaking headless CLI processes.
Both closed: #57498 as a duplicate of #45507, and #45507 labeled
stale rather than resolved. Both are labeled platform:macos. Observed
on this Windows machine as well: ~37 orphaned processes across 5
session trees. Not the subject of this report. Noted because these
accumulated on the same machine where resume fails 100% of the time,
and #45507's own process table lists a stale process carrying a
--resume flag — there may be a relationship between failed resumes
and unreaped processes, though I can't establish causality from the
logs.

Two possible readings, both worth checking:
(a) Path length — favoured, because a merely nonexistent path returns
ENOENT, and EINVAL is characteristic of a path Windows rejects
outright.
(b) Wrong path — per #58421, the generator may be emitting the
un-redirected path when it should emit the LocalCache path. Note the
correct path is longer (482), so it fails either way.

Full 7.2MB main.log covering 2026-05-18 to 2026-07-29 available on
request: 24 local agent sessions, 17 failed turns, 0 successful
resumes.

View original on GitHub ↗