From 041a55855fd83854fd25ccc9f4ba95dc798fe38e Mon Sep 17 00:00:00 2001 From: Benedikt Schackenberg <6381261+BenediktSchackenberg@users.noreply.github.com> Date: Thu, 19 Mar 2026 20:42:34 +0000 Subject: [PATCH] fix: narrow isAlreadyBootstrapped to explicit messages, exclude generic error code 5 --- src/daemon/launchd.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index b2b7559560f..ad4a70530e7 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -486,11 +486,12 @@ function isUnsupportedGuiDomain(detail: string): boolean { function isAlreadyBootstrapped(detail: string): boolean { const normalized = detail.toLowerCase(); - // launchctl bootstrap returns exit code 5 ("Input/output error") or the - // explicit "already loaded" / "already bootstrapped" messages when the - // service target is already registered in the domain. + // Match explicit "already loaded" / "already bootstrapped" messages. + // We intentionally do NOT match the generic "bootstrap failed: 5" + // (Input/output error) because that code also fires for malformed or + // unreadable plists, and treating those as "already loaded" would mask + // real bootstrap failures. return ( - normalized.includes("bootstrap failed: 5") || normalized.includes("already loaded") || normalized.includes("already bootstrapped") );