saadeghi/daisyui · error · Error

Browser exited before starting (exit code ${browserProcess.e

Error message

Browser exited before starting (exit code ${browserProcess.exitCode})

What it means

During the DevTools-port wait, if browserProcess.exitCode becomes non-null (process exited) before the DevToolsActivePort file appears, the script throws with that exit code. This means Chrome started then crashed/closed on its own.

Source

Thrown at packages/tailwind-play-share/index.mjs:268

  throw new Error(
    "Chrome or Chromium was not found. Set TAILWIND_PLAY_BROWSER or pass --browser <path>.",
  )
}

const delay = (milliseconds) =>
  new Promise((resolvePromise) => setTimeout(resolvePromise, milliseconds))

async function waitForDebuggingPort(profileDirectory, browserProcess, timeoutMs, getSpawnError) {
  const activePortFile = join(profileDirectory, "DevToolsActivePort")
  const deadline = Date.now() + timeoutMs

  while (Date.now() < deadline) {
    const spawnError = getSpawnError()
    if (spawnError) {
      throw new Error(`Could not start the browser: ${spawnError.message}`)
    }
    if (browserProcess.exitCode !== null) {
      throw new Error(`Browser exited before starting (exit code ${browserProcess.exitCode})`)
    }

    try {
      const [portText] = (await readFile(activePortFile, "utf8")).trim().split(/\r?\n/)
      const port = Number(portText)
      if (Number.isInteger(port) && port > 0) return port
    } catch {
      // Chrome creates this file after its DevTools server is ready.
    }

    await delay(50)
  }

  throw new Error("Timed out while starting Chrome's DevTools server")
}

async function launchBrowser(executable, { headed, profileDirectory, timeoutMs }) {
  const args = [

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Read the stderr included by the launchBrowser wrapper (error 38) for Chrome's own message.
  2. Install missing shared libraries for Chrome/Chromium.
  3. Try a headed run (--headed) to observe startup.
  4. Ensure the temp directory is writable and not mounted noexec.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await launchBrowser(executable, opts)
} catch (error) {
  if (/Browser exited before starting/.test(error.message)) {
    // read stderr (second line of error.message) for Chrome's own reason
  }
  throw error
}

Prevention

When it happens

Trigger: Chrome exits at startup due to bad flags, missing shared libraries, profile-directory permission errors, or sandbox restrictions.

Common situations: Missing system libs (libnss, libatk, libgbm) on Linux; read-only temp directory; Chrome version that rejects a flag combination used here; sandbox refusal on certain kernels.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/62d5092a3c622d89. Report an issue: GitHub.