louislam/uptime-kuma · error · Error

${e.message}

Error message

${e.message}

What it means

testChrome() runs the full prepareChromeExecutable flow then launches Chromium headless with the resolved path and reads browser.version() to confirm it works. Any failure (launch error, missing shared library, sandbox issue) is caught and re-thrown as a new Error carrying only e.message. This is the 'test this executable' diagnostic path used from the settings UI.

Source

Thrown at server/monitor-types/real-browser-monitor-type.js:228

/**
 * Test if the chrome executable is valid and return the version
 * @param {string} executablePath Path to executable
 * @returns {Promise<string>} Chrome version
 */
async function testChrome(executablePath) {
    try {
        executablePath = await prepareChromeExecutable(executablePath);

        log.info("chromium", "Testing Chromium executable: " + executablePath);

        const browser = await chromium.launch({
            executablePath,
        });
        const version = browser.version();
        await browser.close();
        return version;
    } catch (e) {
        throw new Error(e.message);
    }
}
// test remote browser
/**
 * @param {string} remoteBrowserURL Remote Browser URL
 * @returns {Promise<boolean>} Returns if connection worked
 */
async function testRemoteBrowser(remoteBrowserURL) {
    try {
        const browser = await chromium.connect(remoteBrowserURL);
        browser.version();
        await browser.close();
        return true;
    } catch (e) {
        throw new Error(e.message);
    }
}
class RealBrowserMonitorType extends MonitorType {

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Install Chromium runtime libraries: apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2.
  2. Run the container unprivileged, or pass the appropriate sandbox flags the monitor applies.
  3. Re-run with a known-good Chromium path to isolate executable vs environment.
  4. Check dmesg/journal for OOM or seccomp kills of the chromium process.

Example fix

# before
chromium.launch fails: error while loading shared libraries: libnss3.so
# after
apt-get install -y libnss3 libatk1.0-0 libgbm1
Defensive patterns

Strategy: try-catch

Validate before calling

const { existsSync } = require('fs');
function preflightExecutable(path) {
  if (!path || !existsSync(path)) throw new Error(`Executable missing: ${path}`);
  // Best-effort deps hint for Linux
  if (process.platform === 'linux') console.warn('Ensure libnss3 libgbm1 libatk-bridge2.0-0 libasound2 are installed');
}

Type guard

function looksLikeChromeError(msg) { return /shared lib|sandbox|DevToolsActivePort|chrome/i.test(msg); }

Try / catch

try {
  const v = await testChrome(executablePath);
} catch (e) {
  if (/error while loading shared libraries/.test(e.message)) {
    log.error('Install missing Chromium runtime libraries');
  } else if (/sandbox|SECCOMP/.test(e.message)) {
    log.error('Run unprivileged or apply --no-sandbox equivalent');
  }
  throw e;
}

Prevention

When it happens

Trigger: chromium.launch throws: missing system libraries (libnss, libatk, libgbm), sandbox/permissions issue requiring --no-sandbox, incompatible architecture, broken executable, or version read failure.

Common situations: Running as root in a container without --no-sandbox, missing runtime deps on slim images, ARM binaries on x86, or a stale puppeteer/playwright browsers cache.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/aefb65eb65b1070c. Report an issue: GitHub.