{"record":{"id":"a7e4b359b91dbf96","repo":"GoogleChrome/lighthouse","slug":"no-metrics-for-metric-lanternmetric-lanter","errorCode":null,"errorMessage":"No metrics for ${metric} ${lanternMetric} ${lanternOrBaseline}","messagePattern":"No metrics for (.+?) (.+?) (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/scripts/lantern/constants.js","lineNumber":152,"sourceCode":"      metric,\n      lanternMetric,\n    };\n  },\n\n  /**\n   * @param {LanternSiteDefinition[]} entries\n   * @param {keyof TargetMetrics} metric\n   * @param {keyof LanternMetrics} lanternMetric\n   * @param {'lantern'|'baseline'} lanternOrBaseline\n   * @return {EstimateEvaluationSummary}\n   */\n  evaluateAccuracy(entries, metric, lanternMetric, lanternOrBaseline = 'lantern') {\n    const evaluations = [];\n\n    const percentErrors = [];\n    for (const entry of entries) {\n      const actualMetrics = entry[lanternOrBaseline];\n      if (!actualMetrics) throw new Error(`No metrics for ${metric} ${lanternMetric} ${lanternOrBaseline}`);\n\n      const evaluation = this.evaluateSite(\n        entry,\n        entry.wpt3g,\n        actualMetrics,\n        metric,\n        lanternMetric\n      );\n\n      // No data was available at all, skip it.\n      if (!evaluation) continue;\n\n      // Data was supposed to be available, but one metric was missing, warn.\n      if (!Number.isFinite(evaluation.diff)) {\n        const missingMetric = Number.isFinite(entry.wpt3g[metric]) ? lanternMetric : metric;\n        const message = `WARNING: ${evaluation.url} was missing values for ${missingMetric}`;\n        WARNINGS.push(message);\n        continue;","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/scripts/lantern/constants.js#L134-L170","documentation":"Thrown by evaluateAccuracy() during per-entry iteration. After combineBaselineAndComputedDatasets returns entries that have both .lantern and .baseline, this function reads entry[lanternOrBaseline] to select which metric source to compare against WPT targets. If that property is falsy on a specific entry, the per-entry contract was violated — the entry was supposed to have data for the requested source.","triggerScenarios":"Called from evaluateAndPrintAccuracy in print-correlations.js (lines 96-97) with lanternOrBaseline='lantern' (default) and 'baseline', and from evaluateAllMetrics (constants.js:192). Fires when an entry passed into evaluateAccuracy has a falsy entry[lanternOrBaseline] — e.g., calling with 'baseline' on entries where some lack .baseline, or calling with 'lantern' on entries where .lantern is missing.","commonSituations":"Calling evaluateAccuracy with lanternOrBaseline='baseline' on an entries array not filtered by combineBaselineAndComputedDatasets (which guarantees both sources exist). Manually constructing an entries array with partial data. A baseline fixture that's missing some URLs, combined with entries that passed the combine filter via .lantern alone.","solutions":["Only pass entries produced by combineBaselineAndComputedDatasets into evaluateAccuracy — that function guarantees both .lantern and .baseline exist","If calling with a custom entries array, pre-filter: entries.filter(e => e[lanternOrBaseline])","Verify the baseline fixture covers all URLs in the site index"],"exampleFix":"// before — may throw if some entries lack baseline\nconst result = constants.evaluateAccuracy(entries, metric, lanternMetric, 'baseline');\n\n// after — filter to entries that have the requested source\nconst filtered = entries.filter(e => e[lanternOrBaseline]);\nconst result = constants.evaluateAccuracy(filtered, metric, lanternMetric, lanternOrBaseline);","handlingStrategy":"validation","validationCode":"// Filter entries to only those with the requested metric source\nconst source = lanternOrBaseline; // 'lantern' or 'baseline'\nconst validEntries = entries.filter(e => e[source] != null);\nif (!validEntries.length) {\n  throw new Error(`No entries have ${source} metrics`);\n}\nconst result = constants.evaluateAccuracy(validEntries, metric, lanternMetric, source);","typeGuard":"/** @param {any} entry @param {string} source @returns {boolean} */\nfunction hasMetricSource(entry, source) {\n  return entry != null && typeof entry === 'object' && entry[source] != null && typeof entry[source] === 'object';\n}","tryCatchPattern":null,"preventionTips":["Only pass entries from combineBaselineAndComputedDatasets into evaluateAccuracy","Pre-filter entries to guarantee the requested metric source exists","Ensure the baseline fixture covers all site index URLs"],"tags":["lantern","metrics","evaluation","validation"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}