Repository navigation
Description
What happened
On Windows the in-app update often fails. After clicking install, the NSIS installer shows Failed to uninstall old application files. Please try running the installer again.: 2, and the next launch logs the last update install did not apply and runs the old version. Seen on 25 Oct (3630 → 3643) and twice on 26 Oct (3710 → 3717). Other updates in the same week installed fine.
Diagnosis
Two problems combine.
1. The main process sometimes stays alive after the updater-controlled quit. Run f8b89d6f1e5a (PID 8440, started 09:39:00 with --updated) logged its last lines at 11:14:30:
desktop.lifecycle.beforeQuitForUpdate allowing updater-controlled quit
desktop.lifecycle.beforeQuit before-quit received
20 minutes later the process was still alive: no window, no GPU, renderer, utility or backend children, 42 threads all waiting, CPU still rising slowly (46.69 s → 46.75 s), and T3 Code (Nightly).exe plus @clerk/electron-passkeys/electron-passkeys.win32-x64-msvc.node still loaded. A new instance (dcd9d502da5c) started at 11:16:29 and got the single-instance lock, so the old process had already got through Electron's quit (where the lock is released) and was stuck in process teardown. I could not find which step hangs; no debugger was available on the machine.
2. The installer does not kill a lone leftover process. electron-builder's FIND_PROCESS checks (Get-CimInstance Win32_Process | ? {...}).Count -gt 0. In Windows PowerShell 5.1, .Count on a single CimInstance is empty, so when exactly one process runs from the install folder, the check reports "not running" and nothing is killed. The old uninstaller then can't move the locked exe and rolls back, which gives error 2. Reported upstream as electron-userland/electron-builder#10454, with measurements. With a fully running app (several processes) the check works, which is why most updates succeed and why a slow or stuck main-process exit breaks them.
Confirmation: I ran the same downloaded 3717 installer with --updated /S --force-run while PID 8440 was still alive, recording every process it started. That run inherited a PowerShell 7 PSModulePath, so the installer's Get-ExecutionPolicy probe failed and it used the tasklist / taskkill fallback instead of the PowerShell path. It found PID 8440, taskkill /F ended it, and the update installed (exit code 0, version 3717).
Steps to reproduce
- Windows, desktop app (Nightly), per-user install, started from the Start menu (default
PSModulePath). - Have the main process outlive the updater quit by a few seconds or more, so it is the only process left in the install folder when the installer checks. This happened on its own here; I don't have a deterministic trigger for part 1.
- Install an update from the app.
- The installer shows
Failed to uninstall old application files ...: 2, and the app comes back on the old version.
Part 2 alone reproduces deterministically: start one exe from a folder and run the FIND_PROCESS PowerShell line against that folder (details in the electron-builder issue).
Version
0.1.3-nightly.20261026.3710 updating to 0.1.3-nightly.20261026.3717; electron-builder 26.16.1, electron-updater ^6.8.9, Electron 44.9.3 per apps/desktop/package.json at 6a1c8d1e.
Environment
Windows 11 Enterprise 10.0.26200 x64, corporate-managed, no admin rights, per-user NSIS install, nightly channel. PowerShell execution policy RemoteSigned (LocalMachine), FullLanguage.
Evidence
# desktop.trace.ndjson
11:14:30.797 desktop.updates.installDownloadedUpdate
11:14:30.806 desktop.lifecycle.beforeQuitForUpdate allowing updater-controlled quit
11:14:30.806 desktop.lifecycle.beforeQuit before-quit received
11:16:29 desktop.updates.configure the last update install did not apply {version: ...3710, targetVersion: ...3717}
# processes from the install folder at 11:30
PID 8440 T3 Code (Nightly).exe --updated started 09:39:00 (only process; no --type= children)
# observed installer run at 11:34 (PID 8440 still alive at start)
11:34:27 cmd /C tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq T3 Code (Nightly).exe" ... | findstr ...
11:34:28 taskkill (WM_CLOSE; process has no window, stays)
11:34:30 taskkill /F -> stuck pid 8440 is gone
11:34:31 old-uninstaller.exe /S /KEEP_APP_DATA /currentuser --keep-shortcuts --updated _?=<install dir>
11:34:45 installer exit code 0, installed version 0.1.3-nightly.20261026.3717
Related issues
- NSIS: running-app check misses a single process from $INSTDIR (.Count on one CimInstance is empty in PowerShell 5.1), update fails with error 2 electron-userland/electron-builder#10454: the installer check that misses a single process.
- Desktop app stays running windowless after the "T3 home is unavailable" dialog and ignores Quit and SIGTERM #23843: the desktop app stays running windowless and ignores Quit (macOS, different trigger). Same symptom of a main process that never exits.
- Windows in-app update silently fails when the installer signature check exceeds electron-updater's 20s PowerShell timeout #20345: a different Windows update failure (signature-check timeout during download).
- Windows: app stays launchable during the multi-minute NSIS update extraction, crashes with ERR_MODULE_NOT_FOUND (false-positive #4154) #5520: app launchable during NSIS extraction.
Suggested fix
- Until electron-builder ships a fix, patch
[email protected](the repo already usespatchedDependencies): wrap the pipeline inFIND_PROCESSin@(...)intemplates/nsis/include/allowOnlyOneInstallerInstance.nsh. One line, and it makes the installer end any leftover process, whatever the reason it stayed. - Separately, find out why the main process doesn't exit after the updater-controlled quit on Windows. Fix 1 hides it during updates, but the leftover still holds the exe and native modules until something kills it.
Fix applied or workaround
End the windowless T3 Code (Nightly).exe (the one without --type=) in Task Manager, then install again. Or run the downloaded installer from %LOCALAPPDATA%\t3code-updater\pending\ with --updated /S --force-run after checking its SHA-512 against update-info.json.
Filed by
Claude Code (Claude Opus 5.5), investigating by hand on the affected machine, not via npx t3 triage.
Activity
profitdriventech commentedon Oct 27, 2026
Same pattern on 0.1.3 (Windows 11 26200), except my app was removed entirely, not rolled back. Second time this has happened to me. Full details: #26029
ElliotDrel commentedon Nov 4, 2026
Same failure on the stable channel (0.1.6 → 0.1.7), Windows 11 Home 10.0.26200 x64, per-user install, so it isn't nightly-only.
desktop.trace.ndjson(local time):At 13:36 the only process running from the install folder was the main
T3 Code (Beta).exe(no--type=children), started two days earlier. The installer showedFailed to uninstall old application files. Please try running the installer again.: 2. A new instance launched at 13:17 while the old process was still alive, which is consistent with the old one getting through Electron's quit and then hanging in teardown, as described above.Workaround that worked:
Stop-Processthe leftover main process, then run%LOCALAPPDATA%\t3code-updater\pending\T3-Code-0.1.7-x64.exe(exit 0, installed 0.1.7).Looking forward to #25831.
Investigated with
t3 triageby Claude Code (Claude Opus 5.5).spem commentedon Nov 7, 2026
Same failure on nightly
0.1.8-nightly.20261106.4262→0.1.8-nightly.20261107.4301, on Windows 11 Pro 25H2 (10.0.26200.9711) x64, Intel i5-9600KF, per-user install in%LOCALAPPDATA%\Programs\t3code. #25831 is still not merged, so this still happens on 0.1.8.The installer showed
Failed to uninstall old application files. Please try running the installer again.: 2, and the app came back with the toast "Update did not apply. T3 Code is still on 0.1.8-nightly.20261106.4262".desktop.trace.ndjson(UTC):Processes running from the install folder about 10 minutes later:
T3 Code (Nightly).exe --updated, started 2026-11-06 11:00:53 by the previous update's relaunch. No window (MainWindowHandle0), no child processes, 44 threads, 806 s CPU time, 174 MB working set. It still hasT3 Code (Nightly).exe,electron-passkeys.win32-x64-msvc.nodeandffi-rs.win32-x64-msvc.nodeloaded from the install folder.This is the same as the original report: the main process gets through Electron's quit, then hangs during teardown. It is the only process left in the install folder, so the installer's
FIND_PROCESScheck does not find it, and the old uninstaller cannot remove the locked exe.The downloaded installer is still at
%LOCALAPPDATA%\t3code-updater\pending\T3-Code-0.1.8-nightly.20261107.4301-x64.exe.cgsme commentedon Nov 7, 2026
Same failure on nightly
0.1.8-nightly.20261105.4234→0.1.8-nightly.20261107.4314, Windows 11 (10.0.26200) x64, per-user NSIS install. The toast says:This occurrence also explains the user's report that one update restarts the app several times. There is only one install IPC call and one
ElectronUpdater.quitAndInstall, but four launches still run the old version; the fifth launch runs the target version. No second install request appears between them.desktop.trace.ndjson(local time, UTC+8):The corresponding startup run IDs were
210167d75318,2df8260b1059,08db36e0c5bf, anda194c195701eon ...4234, followed by3ce091fa0677on ...4314. The downloaded installer and its pending copy have identical SHA-512 hashes, so this is not a corrupted/truncated download.I also checked the tagged sources directly: neither
v0.1.8-nightly.20261105.4234norv0.1.8-nightly.20261107.4314contains32b8b50f49/ the@(Get-CimInstance ...)FIND_PROCESSpatch from #25831. That PR is still open, so the known lone-leftover-process failure remains in these builds. The single install request followed by four old-version relaunches is additional evidence that the repeated restarts come from the failed installer/rollback sequence, not from the user repeatedly clicking Update.profitdriventech commentedon Nov 7, 2026
Update on my report above (and #26029): my case turned out to be on my end. Avast was interfering with the installer. I'm withdrawing my report so it doesn't muddy this one. The other reports here look like a separate cause.
ignaciomontenegroc commentedon Nov 12, 2026
Same failure on stable 0.1.8 → 0.1.9, Windows 11 Home 10.0.26100 x64, per-user install in
%LOCALAPPDATA%\Programs\t3code. It happened twice in a row. The leftover process was different this time: it was not a stuck main app process. It was at3CLI command.Trigger: the
t3shim the desktop app installs (~\.t3\bin\t3.cmd) runs the app's own exe withELECTRON_RUN_AS_NODE=1:So any long-running
t3command (doctor,serve,triage) is aT3 Code (Beta).exeprocess running from the install folder. Here at3 doctorstarted at 21:12 was still running during both update attempts. The app's main process exited normally both times. When the installer checked, that CLI process was the only one left, soFIND_PROCESSmissed it (the single-CimInstance.Countbug described above). The old uninstaller then couldn't remove the locked exe and rolled back withFailed to uninstall old application files. Please try running the installer again.: 2.desktop.trace.ndjson(local time):Processes from the install folder after the failures (no app window open):
The downloaded installer is at
%LOCALAPPDATA%\t3code-updater\pending\T3-Code-0.1.9-x64.exe, and its SHA-512 matchesupdate-info.json. I also checked v0.1.9: #25831 is still open, so theFIND_PROCESSfix is not in 0.1.9. The tag'spatches/[email protected]changes_CHECK_APP_RUNNINGbut notFIND_PROCESS.Note for the fix: even with #25831, the installer would end up killing a user's running
t3 serveor other CLI session during an update. It may be worth having the updater warn about, or cleanly stop, CLI processes that run from the app's exe. Another option is to have the shim run from a copy of the exe outside the install folder.Workaround: close any terminal running a
t3command (includingt3 triage, which uses the same exe), then press Update again.Investigated with
t3 triageby Claude Code (Claude Opus 5.5).ignaciomontenegroc commentedon Nov 12, 2026
eli02hergott-cpu commentedon Nov 16, 2026
Same failure on nightly
0.1.10-nightly.20261115.4749→0.1.10-nightly.20261116.4761, Windows 11 Home 10.0.26300 x64, per-user install. #25831 is still unmerged, so this still happens on 0.1.10.This time the update was started remotely (DesktopRemoteUpdates) with nobody at the PC, and that makes it much worse. When the install doesn't apply, nothing relaunches the app, so the machine stays unreachable until someone starts T3 by hand. Here that was about 11.5 hours.
desktop.trace.ndjson(local time):The stuck process looked the same as in the original report. It was the main process started with
--updatedby the previous update, which had installed fine 8 hours earlier. It had no window, 0 child processes and every thread waiting (31 UserRequest, 7 EventPairLow, 4 Unknown), and it was still alive 14+ hours later.resources/andlocales/were touched at 22:25:10, but the exe andapp.asarwere unchanged, and the installed version stayed at 4749. The Application event log had nothing from 22:23 to 22:40. After ending that one process, the pending installer is ready to apply.Besides #25831, a fallback would help remote use: if the update doesn't apply, relaunch the old version (or have the installer always relaunch with
--force-run, even on failure). Then a remote update that fails costs a restart instead of losing access to the machine.arandomhooman commentedon Nov 18, 2026
Same failure on nightly, three times in a row from
0.1.10-nightly.20261116.4800, Windows 11 Pro 10.0.26300 x64, per-user install in%LOCALAPPDATA%\Programs\t3code. The fix hasn't shipped yet:FIND_PROCESSis still unpatched inpatches/[email protected]atv0.1.11-nightly.20261117.4851and onmain, and #25831 is still open.The installer showed
Failed to uninstall old application files. Please try running the installer again.: 2, and the app came back with "Update did not apply. T3 Code is still on 0.1.10-nightly.20261116.4800".desktop.trace.ndjson(local time, UTC-6):What's different from the earlier reports:
resources\andlocales\were touched, while the exe and the other top-level files still carry 11-16 timestamps. The user relaunched by hand at 18:08:51. At 18:10:30 nothing running from the install folder was older than that relaunch, apart from thet3 triageprocess started at 18:10. So whatever held the file outlived the updater quit by at least ~34 s, but it was gone within about 3 minutes. A check for a long-lived windowless process, like the one in the original report, would miss this case. I couldn't identify which process it was.t3CLI command was running during any of the three attempts (the user confirmed this), so it wasn't the shim case described above.t3-resource-monitor.exe. It runs fromresources\resource-monitor\under its own image name, so thetaskkill /IMfallback wouldn't match it. But at the 4800 tag it exits on stdin EOF (native/resource-monitor/src/main.rs), and the server kills it in a scope finalizer (apps/server/src/resourceTelemetry/NativeTelemetryClient.ts), so it shouldn't outlive the backend.--updatedrelaunch. Only the first failed quit came from the--updatedrelaunch. The other two came from runs the user started by hand.The pending installer
%LOCALAPPDATA%\t3code-updater\pending\T3-Code-0.1.11-nightly.20261117.4851-x64.exematches the SHA-512 inupdate-info.jsonand has a valid Authenticode signature (T3 Tools Inc).Investigated with
t3 triageby Claude Code (Claude Opus 5.5).peterpecan commentedon Nov 26, 2026
The Windows desktop update from 0.1.11 to 0.1.12 failed twice. The app kept returning to 0.1.11.
A leftover, windowless T3 Code process was still running. After stopping that process and retrying, the update succeeded; a follow-up check confirmed 0.1.12.
This supports the stale-process workaround described in this issue. The exact installer error was not captured.
Investigated and drafted by Codex (gpt-6.1-sol) through T3 Code.