{"record":{"id":"059bfe2de3478a78","repo":"GoogleChrome/lighthouse","slug":"no-script-treemap-data-found","errorCode":null,"errorMessage":"no script treemap data found","messagePattern":"no script treemap data found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"report/renderer/open-tab.js","lineNumber":105,"sourceCode":"/**\n * Same as openViewer, but uses postMessage.\n * @param {LH.Result} lhr\n * @protected\n */\nasync function openViewerAndSendData(lhr) {\n  const windowName = 'viewer-' + computeWindowNameSuffix(lhr);\n  const url = getAppsOrigin() + '/viewer/';\n  openTabAndSendData({lhr}, url, windowName);\n}\n\n/**\n * Opens a new tab to the treemap app and sends the JSON results using URL.fragment\n * @param {LH.Result} json\n */\nfunction openTreemap(json) {\n  const treemapData = json.audits['script-treemap-data'].details;\n  if (!treemapData) {\n    throw new Error('no script treemap data found');\n  }\n\n  /** @type {LH.Treemap.Options} */\n  const treemapOptions = {\n    lhr: {\n      mainDocumentUrl: json.mainDocumentUrl,\n      finalUrl: json.finalUrl,\n      finalDisplayedUrl: json.finalDisplayedUrl,\n      audits: {\n        'script-treemap-data': json.audits['script-treemap-data'],\n      },\n      configSettings: {\n        locale: json.configSettings.locale,\n      },\n    },\n  };\n  const url = getAppsOrigin() + '/treemap/';\n  const windowName = 'treemap-' + computeWindowNameSuffix(json);","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/report/renderer/open-tab.js#L87-L123","documentation":"Thrown by openTreemap when the supplied Lighthouse Result lacks usable script-treemap-data. The function reads json.audits['script-treemap-data'].details and throws if that details object is absent. The script-treemap-data audit (which powers the module treemap view) must have been gathered and must carry a details payload.","triggerScenarios":"Calling openTreemap(lhr) where lhr.audits['script-treemap-data'] is undefined, or exists but has no/empty 'details'. This happens when the LHR was produced by a config or Lighthouse version that did not run the script-treemap-data audit.","commonSituations":"Older Lighthouse results predating the script-treemap-data audit; custom configs that filter out the audit; PSI/other sources that strip audit details; a report where gather failed so details were omitted.","solutions":["Re-run Lighthouse with a config that includes the 'script-treemap-data' audit and a gatherer that produces details (the default desktop/mobile configs include it).","Guard the UI entry point: only show the 'View Treemap' control when lhr.audits['script-treemap-data']?.details is truthy.","If integrating programmatically, check the audit before calling openTreemap and skip/disable the action otherwise."],"exampleFix":"// before\nopenTreemap(lhr);\n\n// after\nconst treemapAudit = lhr.audits['script-treemap-data'];\nif (treemapAudit?.details) {\n  openTreemap(lhr);\n} else {\n  // hide/disable the treemap action\n}","handlingStrategy":"type-guard","validationCode":"const audit = lhr?.audits?.['script-treemap-data'];\nif (audit?.details) {\n  openTreemap(lhr);\n} else {\n  // hide or disable the 'View Treemap' control\n}","typeGuard":"/** @param {LH.Result} lhr */\nfunction hasTreemapData(lhr) {\n  return Boolean(lhr?.audits?.['script-treemap-data']?.details);\n}","tryCatchPattern":"try {\n  openTreemap(lhr);\n} catch (err) {\n  if (err.message === 'no script treemap data found') {\n    notify('This report has no script treemap data.');\n  } else throw err;\n}","preventionTips":["Gate the treemap action behind lhr.audits['script-treemap-data']?.details being truthy.","Re-run Lighthouse with the default config so the script-treemap-data audit (with details) is gathered.","Treat reports from older versions or filtered configs as potentially lacking the audit."],"tags":["treemap","audit","open-tab","validation"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}