{"record":{"id":"aac2798206d52fe3","repo":"GoogleChrome/lighthouse","slug":"no-lcp-aac279","errorCode":"NO_LCP","errorMessage":"The page did not display content that qualifies as a Largest Contentful Paint (LCP). Ensure the page has a valid LCP element and then try again. ({errorCode})","messagePattern":"The page did not display content that qualifies as a Largest Contentful Paint \\(LCP\\)\\. Ensure the page has a valid LCP element and then try again\\. \\((.+?)\\)","errorType":"exception","errorClass":"LighthouseError","httpStatus":null,"severity":"error","filePath":"core/computed/metrics/largest-contentful-paint.js","lineNumber":38,"sourceCode":"class LargestContentfulPaint extends NavigationMetric {\n  /**\n   * @param {LH.Artifacts.NavigationMetricComputationData} data\n   * @param {LH.Artifacts.ComputedContext} context\n   * @return {Promise<LH.Artifacts.LanternMetric>}\n   */\n  static computeSimulatedMetric(data, context) {\n    const metricData = NavigationMetric.getMetricComputationInput(data);\n    return LanternLargestContentfulPaint.request(metricData, context);\n  }\n\n  /**\n   * @param {LH.Artifacts.NavigationMetricComputationData} data\n   * @return {Promise<LH.Artifacts.Metric>}\n   */\n  static async computeObservedMetric(data) {\n    const {processedNavigation} = data;\n    if (processedNavigation.timings.largestContentfulPaint === undefined) {\n      throw new LighthouseError(LighthouseError.errors.NO_LCP);\n    }\n\n    return {\n      timing: processedNavigation.timings.largestContentfulPaint,\n      timestamp: processedNavigation.timestamps.largestContentfulPaint,\n    };\n  }\n}\n\nconst LargestContentfulPaintComputed = makeComputedArtifact(\n  LargestContentfulPaint,\n  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL', 'SourceMaps', 'HostDPR']\n);\nexport {LargestContentfulPaintComputed as LargestContentfulPaint};\n","sourceCodeStart":20,"sourceCodeEnd":53,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/computed/metrics/largest-contentful-paint.js#L20-L53","documentation":"Thrown as a LighthouseError with code NO_LCP when computeObservedMetric() for the standard LargestContentfulPaint metric finds that processedNavigation.timings.largestContentfulPaint is undefined. This is the primary LCP failure path: the page never produced a qualifying Largest Contentful Paint during the observed trace. Lighthouse cannot compute a timing value for the metric.","triggerScenarios":"Running the LargestContentfulPaint computed artifact in observed mode on a trace where no LCP candidate event was emitted by the browser. The check `processedNavigation.timings.largestContentfulPaint === undefined` is true, triggering the throw.","commonSituations":"Pages with no visible content at load time (blank pages, login walls, JS-rendered SPAs that fail). Background tabs where paint is deferred. Traces collected with insufficient trace categories. Pages where content appears but is below the fold or in a display:none container.","solutions":["Ensure the page renders at least one visible content block (text, image, video poster) above the fold","Use a Chrome version that supports LCP (72+) and run in a visible or new-headless window","If using programmatic trace collection, include 'disabled-by-default-largestContentfulPaint' in trace categories","Verify no JavaScript error prevents content rendering before the trace ends"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check LCP timing before requesting the metric\nconst processedNavigation = await ProcessedNavigation.request(trace, context);\nif (processedNavigation.timings.largestContentfulPaint === undefined) {\n  // No LCP — metric cannot be computed\n  return { timing: undefined, notApplicable: true };\n}","typeGuard":"/** @type {(nav: LH.Artifacts.ProcessedNavigation) => nav is LH.Artifacts.ProcessedNavigation & {timings: {largestContentfulPaint: number}}} */\nfunction hasLCP(nav) {\n  return typeof nav.timings.largestContentfulPaint === 'number';\n}","tryCatchPattern":"try {\n  const lcp = await LargestContentfulPaint.request(data, context);\n} catch (e) {\n  if (e instanceof LighthouseError && e.code === 'NO_LCP') {\n    // Page has no LCP — mark metric as not applicable\n    return { notApplicable: true, reason: 'NO_LCP' };\n  }\n  throw e;\n}","preventionTips":["Ensure the page renders visible content above the fold","Use Chrome 72+ with --headless=new or headed mode","Include 'disabled-by-default-largestContentfulPaint' in trace categories for manual collection","Pre-check processedNavigation.timings.largestContentfulPaint before requesting LCP"],"tags":["lcp","trace","performance","metrics"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}