GoogleChrome/lighthouse · error · Error

provided Lighthouse result is missing audit: `script-treemap

Error message

provided Lighthouse result is missing audit: `script-treemap-data`

What it means

Thrown by treemap's coerceToOptions after it successfully located an LHR (audits object present) but that LHR's audits map does not contain the 'script-treemap-data' entry. The entire treemap is built from this single audit, so it must exist in the result.

Source

Thrown at treemap/app/src/main.js:989

   */
  coerceToOptions(json) {
    /** @type {LH.Treemap.Options['lhr']|null} */
    let lhr = null;
    if (json && typeof json === 'object') {
      for (const maybeLhr of [json, json.lhr, json.lighthouseResult]) {
        if (maybeLhr?.audits && typeof maybeLhr.audits === 'object') {
          lhr = maybeLhr;
          break;
        }
      }
    }

    if (!lhr) {
      throw new Error('provided json is not a Lighthouse result');
    }

    if (!lhr.audits['script-treemap-data']) {
      throw new Error('provided Lighthouse result is missing audit: `script-treemap-data`');
    }

    let initialView;
    if (json && typeof json === 'object' && typeof json.initialView === 'string') {
      initialView = json.initialView;
    }

    return {lhr, initialView};
  }

  /**
   * Loads report json from gist URL, if valid. Updates page URL with gist id
   * and loads from GitHub.
   * @param {string} urlStr gist URL
   */
  async loadFromGistUrl(urlStr) {
    try {
      const url = new URL(urlStr);

View on GitHub (pinned to 9515cd4e58)

Solutions

  1. Re-run Lighthouse with the default config (or explicitly enable the 'script-treemap-data' audit / its gatherer) so the audit and its details are present.
  2. Disable/hide the treemap entry point for LHRs lacking this audit (check lhr.audits['script-treemap-data']).
  3. Inform the user that the loaded report predates or lacks the treemap data.

Example fix

// before
treemapApp.load(lhr); // lhr has no script-treemap-data

// after
if (lhr.audits['script-treemap-data']) {
  treemapApp.load(lhr);
} else {
  notify('This report has no script treemap data; re-run with the default config.');
}
Defensive patterns

Strategy: validation

Validate before calling

if (lhr?.audits?.['script-treemap-data']) {
  treemapApp.load(lhr);
} else {
  notify('Report lacks script-treemap-data; re-run with the default config.');
}

Type guard

/** @param {LH.Result} lhr */
function hasScriptTreemapAudit(lhr) {
  return Boolean(lhr?.audits?.['script-treemap-data']);
}

Try / catch

try {
  treemapApp.load(lhr);
} catch (err) {
  if (err.message.includes('missing audit: `script-treemap-data`')) {
    notify('This report cannot be viewed in the treemap.');
  } else throw err;
}

Prevention

When it happens

Trigger: Passing a valid LHR to the treemap that was produced by a Lighthouse run/config lacking the script-treemap-data audit (e.g. an older version, a filtered custom config, or a PSI response that omits it).

Common situations: Old reports; custom configs that exclude the treemap gatherer; results from tools that re-serialize LHR and drop audits; opening a regular page-audit LHR expecting treemap data without running the right gatherer.

Related errors


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