From 5c2367e8a9514bc5825801bc662b34c2ebde091e Mon Sep 17 00:00:00 2001 From: "Brian J. Fox" Date: Mon, 2 Nov 2026 15:23:25 +0000 Subject: [PATCH] fix(coder): report a missing browser instead of dying when $HOME/browsers is absent --- workflows/coder/check/check-app.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/workflows/coder/check/check-app.ts b/workflows/coder/check/check-app.ts index dd878ff9..5cfd3693 100644 --- a/workflows/coder/check/check-app.ts +++ b/workflows/coder/check/check-app.ts @@ -653,12 +653,22 @@ if (staticRoot) { // The sandbox setup unpacks Chrome's headless shell under $HOME/browsers. A sandboxed process may not // register Mach services, so Chrome runs as one process with its own sandbox off. -const [chrome] = await Array.fromAsync( - new Bun.Glob("chrome-headless-shell-*/chrome-headless-shell").scan({ - cwd: join(homedir(), "browsers"), - absolute: true, - }), -); +// With no browser installed the folder is not there at all, which is the same finding. +const installedBrowsers = async () => { + try { + return await Array.fromAsync( + new Bun.Glob("chrome-headless-shell-*/chrome-headless-shell").scan({ + cwd: join(homedir(), "browsers"), + absolute: true, + }), + ); + } catch (error) { + if (error instanceof Error && "code" in error && error.code === "ENOENT") + return []; + throw error; + } +}; +const [chrome] = await installedBrowsers(); if (!chrome) { stop(); fail("browser", "nothing under $HOME/browsers");