GoogleChrome/lighthouse · error

Usage $0 <computed summary file>

Error message

Usage $0 <computed summary file>

What it means

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.

Source

Thrown at core/scripts/lantern/print-correlations.js:29

/** @typedef {import('./constants').TargetMetrics} TargetMetrics */
/** @typedef {import('./constants').LanternMetrics} LanternMetrics */

import fs from 'fs';
import path from 'path';

import chalk from 'chalk';

import constants from './constants.js';
import {readJson} from '../../test/test-utils.js';

const GOOD_DIFF_AS_PERCENT_THRESHOLD = 0.2;
const OK_DIFF_AS_PERCENT_THRESHOLD = 0.5;

const INPUT_PATH = process.argv[2] || constants.SITE_INDEX_WITH_GOLDEN_WITH_COMPUTED_PATH;
const COMPUTATIONS_PATH = path.resolve(process.cwd(), INPUT_PATH);
const BASELINE_PATH = constants.BASELINE_COMPUTED_PATH;

if (!fs.existsSync(COMPUTATIONS_PATH)) throw new Error('Usage $0 <computed summary file>');

/** @type {{sites: LanternSiteDefinition[]}} */
const siteIndexWithComputed = readJson(COMPUTATIONS_PATH);
const baselineLanternData = readJson(BASELINE_PATH);

const entries = constants.combineBaselineAndComputedDatasets(siteIndexWithComputed,
  baselineLanternData);

/** @param {LanternEvaluation} evaluation */
function isEvaluationGood(evaluation) {
  return evaluation.diffAsPercent < GOOD_DIFF_AS_PERCENT_THRESHOLD;
}
/** @param {LanternEvaluation} evaluation */
function isEvaluationOK(evaluation) {
  return (
    evaluation.diffAsPercent >= GOOD_DIFF_AS_PERCENT_THRESHOLD &&
    evaluation.diffAsPercent < OK_DIFF_AS_PERCENT_THRESHOLD
  );

View on GitHub (pinned to 9515cd4e58)

Solutions

  1. Run run-on-all-assets.js first to generate the computed file at .tmp/site-index-plus-golden-expectations-plus-computed.json
  2. If passing a custom path, verify it exists: `ls -la <path>` before running
  3. Run from the correct working directory (the default path is relative to cwd)
Defensive patterns

Strategy: validation

Validate before calling

if (!fs.existsSync(COMPUTATIONS_PATH)) {
  console.error(`File not found: ${COMPUTATIONS_PATH}`);
  console.error('Did you run run-on-all-assets.js first?');
  process.exit(1);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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)).

Related errors


AI-assisted analysis of GoogleChrome/lighthouse@9515cd4e58 (2026-08-13). Data as JSON: /api/errors/d4a7a326b482fb2a. Report an issue: GitHub.