{"record":{"id":"cfe4796f09f1c6de","repo":"GoogleChrome/lighthouse","slug":"usage-0-expectations-file","errorCode":null,"errorMessage":"Usage $0 <expectations file>","messagePattern":"Usage \\$0 <expectations file>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/scripts/lantern/run-on-all-assets.js","lineNumber":38,"sourceCode":"import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport childProcess from 'child_process';\nimport util from 'util';\n\nimport constants from './constants.js';\nimport {LH_ROOT} from '../../../shared/root.js';\nimport {readJson} from '../../test/test-utils.js';\nimport {ConcurrentMapper} from '../../../cli/test/smokehouse/lib/concurrent-mapper.js';\n\nconst execFile = util.promisify(childProcess.execFile);\n\nconst INPUT_PATH = process.argv[2] || constants.SITE_INDEX_WITH_GOLDEN_PATH;\nconst SITE_INDEX_PATH = path.resolve(process.cwd(), INPUT_PATH);\nconst SITE_INDEX_DIR = path.dirname(SITE_INDEX_PATH);\nconst RUN_ONCE_PATH = path.join(LH_ROOT, 'core/scripts/lantern/run-once.js');\n\nif (!fs.existsSync(SITE_INDEX_PATH)) throw new Error('Usage $0 <expectations file>');\n\n/** @type {Golden} */\nconst expectations = readJson(SITE_INDEX_PATH);\n\nconst concurrency = process.env.CI ?\n  os.cpus().length :\n  Math.max(os.cpus().length - 2, 1);\nconsole.log(`Running across ${concurrency} processes ...`);\n\nawait ConcurrentMapper.map(expectations.sites, async (site) => {\n  const trace = path.join(SITE_INDEX_DIR, site.unthrottled.tracePath);\n  const log = path.join(SITE_INDEX_DIR, site.unthrottled.devtoolsLogPath);\n\n  console.log('Running', site.url, '...');\n  try {\n    const rawOutput = (await execFile(RUN_ONCE_PATH, [trace, log])).stdout.trim();\n    if (!rawOutput) console.log(site.url, 'ERROR EMPTY OUTPUT!');\n    const lantern = JSON.parse(rawOutput);","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/scripts/lantern/run-on-all-assets.js#L20-L56","documentation":"Usage guard in run-on-all-assets.js. The script reads a golden expectations JSON file containing site definitions with trace and devtools log paths. If the resolved path does not exist on disk, it cannot locate the trace files to compute Lantern metrics from.","triggerScenarios":"Running run-on-all-assets.js when the site index file doesn't exist at the resolved path. The default path is './lantern-data/site-index-plus-golden-expectations.json' (relative to cwd). A custom path passed as argv[2] that doesn't exist also triggers it.","commonSituations":"Running from the wrong working directory — the default path is relative to process.cwd(), so running from repo root instead of the lantern directory (or vice versa) resolves to a non-existent file. Fresh clone missing the lantern-data directory. File was renamed or moved in a version update.","solutions":["Run from the correct working directory (the script resolves paths relative to cwd)","Verify the default file exists: check ./lantern-data/site-index-plus-golden-expectations.json relative to your cwd","Pass the correct absolute path as argv[2] if running from a different directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!fs.existsSync(SITE_INDEX_PATH)) {\n  console.error(`File not found: ${SITE_INDEX_PATH}`);\n  console.error('Run from the lantern/ directory or pass an absolute path');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run from the working directory where the site index path resolves correctly","Pass an absolute path as argv[2] if unsure of cwd","Verify the lantern-data directory exists in your checkout"],"tags":["cli","usage","lantern","file-not-found","working-directory"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}