BTT left running from Sparkle staging folder after interrupted update → AppleScriptRunner XPC crash loop

Affected input device: none (update mechanism / AppleScript runner)

BTT version: 6.521 (build 2026051309)
macOS: 26.5.1
Device: Mac14,7 (13" M2 MacBook Pro with Touch Bar)
Setup: GoldenChaos-style Touch Bar preset with many AppleScript widgets on 5s update intervals

Description

On Jun 1 a BTT auto-update was interrupted mid-swap. Afterwards:

  • /Applications/BetterTouchTool.app no longer existed.
  • The only copy of the app was inside the Sparkle staging folder
    /Applications/(正在由Sparkle儲存的文件)/BetterTouchTool.app
    (localized name of "(A Document Being Saved By Sparkle)").
  • Because the login item bookmark resolved to the moved bundle, BTT kept
    launching from the staging folder for the next 10 days without any visible
    warning.

While running from that path, the embedded
BetterTouchToolAppleScriptRunner.xpc connection was repeatedly invalidated,
producing AppleScript error popups and eventually crashing BTT entirely.

Evidence

ps showed every process running from the staging path, including both XPC
services:

/Applications/(正在由Sparkle儲存的文件)/BetterTouchTool.app/Contents/MacOS/BetterTouchTool
/Applications/(正在由Sparkle儲存的文件)/BetterTouchTool.app/Contents/XPCServices/BetterTouchToolAppleScriptRunner.xpc/...
/Applications/(正在由Sparkle儲存的文件)/BetterTouchTool.app/Contents/XPCServices/BetterTouchToolShellScriptRunner.xpc/...

BTT's own log (~/Library/Application Support/BetterTouchTool/Logs/) shows
error storms on Jun 8 (~11:51) and Jun 11 (~10:53, UTC+8), hundreds of lines
like:

error init apple script xpc
Lost Connection ... Error Domain=NSCocoaErrorDomain Code=4099
  "The connection to service named com.hegenberg.BetterTouchToolAppleScriptRunner
   was invalidated from this process."
apple script contains error and crashes BTT

followed by a full BTT crash + relaunch. The unified log's TCC entries
confirmed the executable URL:

kTCCCodeIdentityExecutableURL = "file:///Applications/%EF%BC%88...Sparkle...%EF%BC%89/BetterTouchTool.app/..."

Workaround that fixed it

  1. Kill all BTT processes (note: BTTRelaunch kept respawning BTT, took several
    kill rounds).
  2. mv the app bundle back to /Applications/BetterTouchTool.app, delete the
    empty staging folder.
  3. lsregister -f the new path, relaunch.
  4. Recreate the login item (the background-task-management record still pointed
    at the staging URL).

Zero XPC/AppleScript errors since.

Suggestions

  1. On launch, BTT could detect that its bundle path contains the Sparkle
    staging folder name and offer to move itself back to /Applications
    (or at least warn loudly) instead of running degraded for days.
  2. The leftover-staging-folder issue was reported before
    (community thread "Applications folder littered with Sparkle folders",
    thread 33683, and "(A Document Being Saved By Sparkle)" thread 29304),
    but in this case the swap failed in the worse direction: nothing was left
    at the destination path. Might be worth checking the Sparkle swap/cleanup
    step on macOS 26.x.

Happy to provide the full BTT log files if useful.