fix: surface load failure detail alongside GUI-session guidance

When bootstrap fails with a GUI-domain error but launchctl load fails for a
different reason (permissions, plist syntax), include both error details so
users can diagnose the actual problem.
This commit is contained in:
Benedikt Schackenberg 2026-03-16 20:51:00 +00:00
parent e57ebd641c
commit 91db7c72a1

View File

@ -231,11 +231,12 @@ async function bootstrapLaunchAgentOrThrow(params: {
return;
}
const loadDetail = (load.stderr || load.stdout).trim();
// Only show GUI-session guidance when the failure is actually gui-domain related.
// For other load failures (e.g. plist syntax, permissions), surface the real error.
// Only show GUI-session guidance when the failure is actually gui-domain related
// and the load fallback didn't reveal a different, more actionable error.
if (isUnsupportedGuiDomain(effectiveDetail)) {
const isLoadDifferentError = loadDetail && !isUnsupportedGuiDomain(loadDetail);
throwBootstrapGuiSessionError({
detail: effectiveDetail,
detail: isLoadDifferentError ? `${loadDetail} (bootstrap: ${effectiveDetail})` : effectiveDetail,
domain: params.domain,
actionHint: params.actionHint,
});