[Desktop] `claude://code/new?folder=…&q=…` intermittently starts the session in a scratch workspace instead of the folder

Status Open
Reported on v2.1.284
Maintainer reply None cached
Activity 1 comment · opened Sep 30, 2026

App: Claude desktop 2.9939.4 (Linux x64, deb), Claude Code 2.1.284, Code tab.
Frequency: intermittent, ~11 of ~30 deep links between 2026-09-23 and 2026-09-29.

Steps

  1. With the app running, open claude://code/new?folder=/home/<user>/repo&q=<prompt> (e.g. xdg-open).
  2. The trust dialog appears for the folder (even though it was trusted before). Click trust.
  3. Send the prefilled prompt.

Expected: the session starts in /home/<user>/repo.
Actual (intermittent): the session starts in ~/.config/Claude/scratch-workspaces/<account>/<org>/scratch-<date>-<id>.

Log signature (~/.config/Claude/logs/main.log)

Failing case:

21:25:14 second-instance: suppressing duplicate argv
21:25:16 LocalSessions.saveTrust: cwd=/home/<user>/repo
21:25:16 Saved workspace trust for /home/<user>/repo
21:25:20 LocalSessions.createScratchWorkspace
21:25:21 [CCD] minted scratch workspace …/scratch-2026-09-30-1b9ecc
21:25:21 Starting local session local_… in …/scratch-2026-09-30-1b9ecc

Working case (same machine, same folder):

19:59:29 second-instance: suppressing duplicate argv
19:59:29 LocalSessions.checkTrust: cwd=/home/<user>/repo
19:59:32 LocalSessions.saveTrust: cwd=/home/<user>/repo
19:59:40 Starting local session local_… in /home/<user>/repo

The trust for the folder is saved, but the composer sends with no folder selected. Whether another local session has a turn running, the time between trust and send, and running xdg-open inside or outside a sandbox do not correlate with the failure.

Likely mechanism (from reading the shipped renderer bundle; the exact trigger is inferred)

  • With claudeai_cc_epitaxy_folderless_start_main on, the composer computes folderlessDraft = flag && envType === "local" && selectedFolder === null and mints a scratch workspace on send.
  • adoptExternalFolder (route reading folder / src=external) always calls requestTrust when q is present, then applies the folder with applyLocalFolderPick only if its generation counter is unchanged (s === i.current) when the dialog resolves. The trust dialog calls saveTrust before resolving, so trust is logged even when the result is discarded.
  • Anything that runs the adoption's cancel between dialog open and accept drops the folder silently: the route effect re-running (the URL keeps folder and src=external), the effect cleanup when the focused session id changes or the route unmounts, or an already-pending trust dialog from another requester (the adoption returns early).
  • No log line records the discarded result, and no URL parameter opts out of the scratch fallback.

Suggested fixes

  • Do not discard an accepted trust result for the same folder; apply the folder (or keep it in the draft) when the dialog resolves true.
  • Skip the trust dialog for already-trusted folders even when q is present.
  • Never fall back to a scratch workspace when the navigation carried an explicit folder; show an error or keep the folder chip instead.
  • Log when an external folder adoption is cancelled or its result dropped.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗