Linux AppImage: mount dirs from earlier launches pile up on the server PATH; a dead one makes every git spawn fail with ENOTCONN #18790
What happened#
Starting a new thread in a project failed with "workspace prep failed ENOTCONN".
Diagnosis#
Every git spawn from the server failed with Error: spawn ENOTCONN (worktree prep, GitManager.branchPullRequest.remotes, ThreadPullRequestServiceV2.synchronize).
- The server process's PATH held 8 AppImage mount dirs (
<cache>/t3code/tmp/.mount_T3-Cod*and…/usr/sbin), one per launch going back 5 days. All of them came before/usr/bin. - 6 AppImage runtime processes from earlier launches (Oct 7–12) were still alive, each keeping its mount alive. The oldest mount was dead:
lsreturnedTransport endpoint is not connected. - PATH lookup during spawn stops at the first error other than ENOENT/EACCES/ENOTDIR. The dead mount returns ENOTCONN, so the search ended before
/usr/bin/git. Reproduced with the server's exact PATH:env PATH="$SERVER_PATH" git --version→env: 'git': Transport endpoint is not connected. - How it piles up: each new instance inherits the previous instance's environment (PATH already including the old mount), and the AppImage runtime adds its own
APPDIRin front. Evidence: an Oct 11 runtime process had 4 mounts on PATH, and the Oct 12 one had 7 plus its own. Nightly auto-updates relaunch roughly daily. Inferred, not confirmed: the updater/relaunch path starts the new AppImage withprocess.envas is. - Source (
v0.0.46-nightly.20261012.3021, same onmain):stripAppImageRuntimeEnvinapps/server/src/terminal/Manager.tsremoves only the currentAPPDIRsegments, and only for terminal PTYs. Nothing cleans.mount_*segments from earlier launches out of the desktop/server process env.DesktopShellEnvironment.installPosixEnvironmentmerges the login-shell PATH with the inheritedprocess.env.PATH, which keeps the stale entries.
Suggested fix: at desktop startup, remove every PATH (and LD_LIBRARY_PATH/XDG_DATA_DIRS) segment that is under any .mount_* AppImage mount except the current APPDIR. Do this before the server is spawned, and also scrub the env passed to relaunch/update.
Steps to reproduce#
- Linux, run the AppImage build from a desktop launcher.
- Restart it several times in a way that hands down the env (in-app relaunch or nightly auto-update).
- Inspect the server's PATH:
tr '\0' '\n' < /proc/<server-pid>/environ | grep ^PATH=. It shows one.mount_T3-*pair per earlier launch. - Kill the AppImage runtime of one older launch (or wait for it to die). Its mount turns into ENOTCONN.
- Start a thread / worktree. Workspace prep fails with
spawn ENOTCONN.
Version#
0.0.46-nightly.20261012.3021 (desktop AppImage)
Environment#
CachyOS Linux x64 (kernel 7.2.8), Wayland, Node v26.8.2, git 2.55.0
Evidence#
runGitCommand git.cwd=<home>/.t3/worktrees/<project>/t3-918b8cb8
exit: Failure Error: spawn ENOTCONN
at ChildProcess.spawn (node:internal/child_process:458:11)
at Module.spawn (node:child_process:813:9)
at runGitCommand (…/apps/server/dist/binCli-*.mjs:120805:5)
at GitManager.branchPullRequest.remotes (…)
ThreadPullRequestServiceV2.synchronize event: "thread branch pull request lookup failed" cause: Error: spawn ENOTCONN
Server PATH (excerpt):
<home>/.local/bin : … : <cache>/t3code/tmp/.mount_T3-CodDlgiNJ : …/usr/sbin
: .mount_T3-CodbBAAcc : .mount_T3-CodBcobcf : .mount_T3-CodJKbOcO : .mount_T3-CodkdaOdj
: .mount_T3-CodFHbFnM : .mount_T3-CodloMHfl : .mount_T3-CodGLOGmC (dead) : /usr/local/bin : /usr/bin …
$ ls <cache>/t3code/tmp/.mount_T3-CodGLOGmC
ls: cannot open directory: Transport endpoint is not connected
Related issues#
#14259 (AppImage mount disappears, children die with SIGBUS) is a related way an AppImage mount can die, but the bug there is the main process exiting. Here the main process stays alive and stale mounts pile up on PATH. Not a duplicate.
Fix applied or workaround#
fusermount3 -uz on the dead mount (it becomes an empty dir, so PATH lookup skips it). Git spawns worked again right away with no restart. Lasting workaround: fully quit and relaunch from the desktop launcher so the app starts with a fresh environment.
Filed by#
Claude Code (claude-opus-5-5) via t3 triage
Note
Grok responding on behalf of Julius.
Thanks for the detailed diagnosis. I checked it against
main:stripAppImageRuntimeEnv(apps/server/src/terminal/Manager.ts) only removes PATH segments under the currentAPPDIR, and it only runs on terminal PTYs (#3108, #5075). Segments from earlier launches'.mount_*dirs are never removed.DesktopShellEnvironmentmerges the login-shell PATH with the inheritedprocess.env.PATH, so stale mount segments get carried into the server env. The server's own spawns (git, worktree prep, PR sync) use that env as is.- Open PR #16679 (for #16456) moves the same scrub into provider session envs. It still only matches the current
APPDIR, and it doesn't touch the server process env or its git spawns, so it wouldn't fix this. #14259 is a different failure (the main process dies).
I'm accepting this as a bug. The fix belongs at desktop startup, before the server is spawned: remove every PATH /
LD_LIBRARY_PATH/XDG_DATA_DIRSsegment under any AppImage.mount_*dir other than the currentAPPDIR, and apply the same scrub to the env used for relaunch/update. Ideally this lives in the shared helper from #16679 so terminals and agents get it too.Workaround until then: fully quit T3 Code and start it from the desktop launcher so it gets a fresh environment, or
fusermount3 -uzthe dead mount.juliusmarminge added labelsaccepted
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
This was done via t3 code triage.