{"record":{"id":"37a3a9ff1dd7789c","repo":"GoogleChrome/lighthouse","slug":"provided-lighthouse-result-is-missing-audit-scri","errorCode":null,"errorMessage":"provided Lighthouse result is missing audit: `script-treemap-data`","messagePattern":"provided Lighthouse result is missing audit: `script-treemap-data`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"treemap/app/src/main.js","lineNumber":989,"sourceCode":"   */\n  coerceToOptions(json) {\n    /** @type {LH.Treemap.Options['lhr']|null} */\n    let lhr = null;\n    if (json && typeof json === 'object') {\n      for (const maybeLhr of [json, json.lhr, json.lighthouseResult]) {\n        if (maybeLhr?.audits && typeof maybeLhr.audits === 'object') {\n          lhr = maybeLhr;\n          break;\n        }\n      }\n    }\n\n    if (!lhr) {\n      throw new Error('provided json is not a Lighthouse result');\n    }\n\n    if (!lhr.audits['script-treemap-data']) {\n      throw new Error('provided Lighthouse result is missing audit: `script-treemap-data`');\n    }\n\n    let initialView;\n    if (json && typeof json === 'object' && typeof json.initialView === 'string') {\n      initialView = json.initialView;\n    }\n\n    return {lhr, initialView};\n  }\n\n  /**\n   * Loads report json from gist URL, if valid. Updates page URL with gist id\n   * and loads from GitHub.\n   * @param {string} urlStr gist URL\n   */\n  async loadFromGistUrl(urlStr) {\n    try {\n      const url = new URL(urlStr);","sourceCodeStart":971,"sourceCodeEnd":1007,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/treemap/app/src/main.js#L971-L1007","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","Disable/hide the treemap entry point for LHRs lacking this audit (check lhr.audits['script-treemap-data']).","Inform the user that the loaded report predates or lacks the treemap data."],"exampleFix":"// before\ntreemapApp.load(lhr); // lhr has no script-treemap-data\n\n// after\nif (lhr.audits['script-treemap-data']) {\n  treemapApp.load(lhr);\n} else {\n  notify('This report has no script treemap data; re-run with the default config.');\n}","handlingStrategy":"validation","validationCode":"if (lhr?.audits?.['script-treemap-data']) {\n  treemapApp.load(lhr);\n} else {\n  notify('Report lacks script-treemap-data; re-run with the default config.');\n}","typeGuard":"/** @param {LH.Result} lhr */\nfunction hasScriptTreemapAudit(lhr) {\n  return Boolean(lhr?.audits?.['script-treemap-data']);\n}","tryCatchPattern":"try {\n  treemapApp.load(lhr);\n} catch (err) {\n  if (err.message.includes('missing audit: `script-treemap-data`')) {\n    notify('This report cannot be viewed in the treemap.');\n  } else throw err;\n}","preventionTips":["Check lhr.audits['script-treemap-data'] exists before opening the treemap.","Use a Lighthouse config that includes the script-treemap-data audit when generating reports for the treemap.","Be aware older reports and some custom/PSI configs omit this audit."],"tags":["treemap","audit","validation","lhr"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}