GoogleChrome/lighthouse · error

runtime error: ${lhr.runtimeError}

Error message

runtime error: ${lhr.runtimeError}

What it means

Thrown by assertLhr() when the Lighthouse Result object has a non-null/non-empty `runtimeError` property. This means Lighthouse itself encountered a runtime failure during the run (e.g. page load error, navigation timeout, protocol error) even though a result object was returned. The script refuses to treat a runtime-errored run as valid for metric comparison.

Source

Thrown at core/scripts/lantern/collect/collect.js:189

  for (let i = 0; i < maxAttempts; i++) {
    try {
      return {result: await asyncFn(), retries: i, errors};
    } catch (err) {
      log.log('Error: ' + err.toString());
      errors.push(err.toString());
    }
  }

  return {result: null, retries: maxAttempts - 1, errors};
}

/**
 * @param {LH.Result=} lhr
 */
function assertLhr(lhr) {
  if (!lhr) throw new Error('missing lhr');
  if (lhr.runtimeError) throw new Error(`runtime error: ${lhr.runtimeError}`);
  const metrics = common.getMetrics(lhr);
  if (metrics?.firstContentfulPaint &&
      metrics.interactive &&
      // WPT won't have this, we'll just get from the trace.
      // metrics.largestContentfulPaint &&
      metrics.maxPotentialFID &&
      metrics.speedIndex
  ) return;
  throw new Error('run failed to get metrics');
}

async function main() {
  // Resume state from previous invocation of script.
  summary = common.loadSummary();

  // Remove data if no longer in TEST_URLS.
  summary.results = summary.results
    .filter(urlSet => TEST_URLS.includes(urlSet.url));

View on GitHub (pinned to 9515cd4e58)

Solutions

  1. Check lhr.runtimeError code/message (printed in the error) for the specific failure reason.
  2. Retry the collection — many runtime errors are transient (navigation timeouts, protocol flakes).
  3. If persistent, verify the target URL loads in a browser and the WPT location/browser is healthy.
Defensive patterns

Strategy: retry

Validate before calling

function lhrHasRuntimeError(lhr) {
  return Boolean(lhr && lhr.runtimeError && (lhr.runtimeError.code || lhr.runtimeError.message));
}
function lhrHasRequiredMetrics(lhr) {
  const m = common.getMetrics(lhr);
  return Boolean(m?.firstContentfulPaint && m?.interactive && m?.maxPotentialFID && m?.speedIndex);
}

Try / catch

for (let attempt = 0; attempt < maxAttempts; attempt++) {
  const {result: lhr} = await runLighthouse(url);
  if (!lhrHasRuntimeError(lhr) && lhrHasRequiredMetrics(lhr)) { /* success */ break; }
  if (attempt === maxAttempts - 1) throw new Error(`runtime error: ${lhr.runtimeError}`);
}

Prevention

When it happens

Trigger: Collecting Lantern metrics via WPT where the Lighthouse run completed but recorded a runtimeError — page failed to load, connection reset, or a DevTools protocol disconnect.

Common situations: Target URL is down or extremely slow; WPT agent environment issues; browser/Chrome version incompatibility; network errors during the audit.

Related errors


AI-assisted analysis of GoogleChrome/lighthouse@9515cd4e58 (2026-08-13). Data as JSON: /api/errors/b6876e85cf7b1a0a. Report an issue: GitHub.