{"record":{"id":"d4a7a326b482fb2a","repo":"GoogleChrome/lighthouse","slug":"usage-0-computed-summary-file","errorCode":null,"errorMessage":"Usage $0 <computed summary file>","messagePattern":"Usage \\$0 <computed summary file>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/scripts/lantern/print-correlations.js","lineNumber":29,"sourceCode":"/** @typedef {import('./constants').TargetMetrics} TargetMetrics */\n/** @typedef {import('./constants').LanternMetrics} LanternMetrics */\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport chalk from 'chalk';\n\nimport constants from './constants.js';\nimport {readJson} from '../../test/test-utils.js';\n\nconst GOOD_DIFF_AS_PERCENT_THRESHOLD = 0.2;\nconst OK_DIFF_AS_PERCENT_THRESHOLD = 0.5;\n\nconst INPUT_PATH = process.argv[2] || constants.SITE_INDEX_WITH_GOLDEN_WITH_COMPUTED_PATH;\nconst COMPUTATIONS_PATH = path.resolve(process.cwd(), INPUT_PATH);\nconst BASELINE_PATH = constants.BASELINE_COMPUTED_PATH;\n\nif (!fs.existsSync(COMPUTATIONS_PATH)) throw new Error('Usage $0 <computed summary file>');\n\n/** @type {{sites: LanternSiteDefinition[]}} */\nconst siteIndexWithComputed = readJson(COMPUTATIONS_PATH);\nconst baselineLanternData = readJson(BASELINE_PATH);\n\nconst entries = constants.combineBaselineAndComputedDatasets(siteIndexWithComputed,\n  baselineLanternData);\n\n/** @param {LanternEvaluation} evaluation */\nfunction isEvaluationGood(evaluation) {\n  return evaluation.diffAsPercent < GOOD_DIFF_AS_PERCENT_THRESHOLD;\n}\n/** @param {LanternEvaluation} evaluation */\nfunction isEvaluationOK(evaluation) {\n  return (\n    evaluation.diffAsPercent >= GOOD_DIFF_AS_PERCENT_THRESHOLD &&\n    evaluation.diffAsPercent < OK_DIFF_AS_PERCENT_THRESHOLD\n  );","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/scripts/lantern/print-correlations.js#L11-L47","documentation":"Usage guard in print-correlations.js. The script reads a computed summary JSON file, defaulting to a .tmp path generated by run-on-all-assets.js. If the resolved path does not exist on disk, the script cannot proceed — it needs computed Lantern metrics to print accuracy correlations.","triggerScenarios":"Running print-correlations.js when the default computed file (.tmp/site-index-plus-golden-expectations-plus-computed.json) doesn't exist, or when a custom path passed as argv[2] doesn't exist. fs.existsSync returns false at line 29.","commonSituations":"Running print-correlations.js before run-on-all-assets.js (the .tmp file is generated by the latter). The .tmp directory was cleaned (git clean, npm run clean). Passing a relative path from the wrong working directory (the path is resolved via path.resolve(process.cwd(), INPUT_PATH)).","solutions":["Run run-on-all-assets.js first to generate the computed file at .tmp/site-index-plus-golden-expectations-plus-computed.json","If passing a custom path, verify it exists: `ls -la <path>` before running","Run from the correct working directory (the default path is relative to cwd)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!fs.existsSync(COMPUTATIONS_PATH)) {\n  console.error(`File not found: ${COMPUTATIONS_PATH}`);\n  console.error('Did you run run-on-all-assets.js first?');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run run-on-all-assets.js before print-correlations.js","Verify the .tmp computed file exists before running","Pass an absolute path if running from a non-default working directory"],"tags":["cli","usage","lantern","file-not-found","ordering"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}