{"record":{"id":"5acc281f34a27a28","repo":"GoogleChrome/lighthouse","slug":"no-lcp","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/lcp-image-record.js","lineNumber":29,"sourceCode":"\n/**\n * @fileoverview Match the LCP event with the paint event to get the request of the image actually painted.\n * This could differ from the `ImageElement` associated with the nodeId if e.g. the LCP\n * was a pseudo-element associated with a node containing a smaller background-image.\n */\n\nclass LCPImageRecord {\n  /**\n   * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog}} data\n   * @param {LH.Artifacts.ComputedContext} context\n   * @return {Promise<LH.Artifacts.NetworkRequest|undefined>}\n   */\n  static async compute_(data, context) {\n    const {trace, devtoolsLog} = data;\n    const networkRecords = await NetworkRecords.request(devtoolsLog, context);\n    const processedNavigation = await ProcessedNavigation.request(trace, context);\n    if (processedNavigation.timings.largestContentfulPaint === undefined) {\n      throw new LighthouseError(LighthouseError.errors.NO_LCP);\n    }\n\n    // Use main-frame-only LCP to match the metric value.\n    const lcpEvent = processedNavigation.largestContentfulPaintEvt;\n    if (!lcpEvent) return;\n\n    const lcpImagePaintEvent = trace.traceEvents.filter(e => {\n      return e.name === 'LargestImagePaint::Candidate' &&\n          e.args.frame === lcpEvent.args.frame &&\n          e.args.data?.DOMNodeId === lcpEvent.args.data?.nodeId &&\n          e.args.data?.size === lcpEvent.args.data?.size;\n    // Get last candidate, in case there was more than one.\n    }).sort((a, b) => b.ts - a.ts)[0];\n\n    const lcpUrl = lcpImagePaintEvent?.args.data?.imageUrl;\n    if (!lcpUrl) return;\n\n    const candidates = networkRecords.filter(record => {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/computed/lcp-image-record.js#L11-L47","documentation":"Thrown as a LighthouseError with code NO_LCP when LCPImageRecord.compute_() finds that processedNavigation.timings.largestContentfulPaint is undefined. This means the page never produced a Largest Contentful Paint event during the trace, so there is no LCP image to associate. The LCP metric itself would also fail to compute for the same reason.","triggerScenarios":"Calling LCPImageRecord.request() on a trace where the browser never emitted an LCP candidate event. This happens on pages with no visible content at load, pages that load in a hidden tab, or pages where the LCP polyfill/event was not captured in the trace.","commonSituations":"Auditing a page behind a login wall that renders no content. Headless Chrome running with viewport visibility off. A page that renders everything via JavaScript that fails to execute. Trace collected too early or with an incomplete trace category set.","solutions":["Ensure the page has visible content above the fold before the trace completes","Verify Chrome was not run with --headless in a mode that suppresses paint events, or use --headless=new","Check that the trace includes the 'disabled-by-default-largestContentfulPaint' category if collecting traces manually","Run the Lighthouse audit again after confirming the page renders content"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check for LCP timing before requesting LCPImageRecord\nconst processedNavigation = await ProcessedNavigation.request(trace, context);\nif (processedNavigation.timings.largestContentfulPaint === undefined) {\n  // No LCP — skip image record computation\n  return undefined;\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 lcpRecord = await LCPImageRecord.request(data, context);\n} catch (e) {\n  if (e instanceof LighthouseError && e.code === 'NO_LCP') {\n    // Page has no LCP element — skip LCP image analysis\n    return;\n  }\n  throw e;\n}","preventionTips":["Ensure the page renders visible content above the fold before trace capture ends","Use --headless=new or headed Chrome to preserve paint event capture","Include 'disabled-by-default-largestContentfulPaint' in trace categories when collecting manually","Pre-check processedNavigation.timings.largestContentfulPaint before requesting LCPImageRecord"],"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"}