GoogleChrome/lighthouse · error
Usage $0: <url>
Error message
Usage $0: <url>
What it means
Usage guard at the top of debug-url.js, a CLI script that launches a debug Lantern run for a single URL. It reads the URL from process.argv[2] and throws immediately if no positional argument was provided. This is a standard argument-validation pattern for standalone Node scripts.
Source
Thrown at core/scripts/lantern/debug-url.js:16
#!/usr/bin/env node
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'path';
import {execFileSync} from 'child_process';
import constants from './constants.js';
import {LH_ROOT} from '../../../shared/root.js';
import {readJson} from '../../test/test-utils.js';
const INPUT_URL = process.argv[2];
if (!INPUT_URL) throw new Error('Usage $0: <url>');
const SITE_INDEX_PATH = path.resolve(process.cwd(), constants.SITE_INDEX_WITH_GOLDEN_PATH);
const SITE_INDEX_DIR = path.dirname(SITE_INDEX_PATH);
const RUN_ONCE_PATH = path.join(LH_ROOT, 'core/scripts/lantern/run-once.js');
const siteIndex = readJson(SITE_INDEX_PATH);
// @ts-expect-error - over-aggressive implicit any on site
const site = siteIndex.sites.find(site => site.url === INPUT_URL);
if (!site) throw new Error(`Could not find with site URL ${INPUT_URL}`);
const trace = path.join(SITE_INDEX_DIR, site.unthrottled.tracePath);
const log = path.join(SITE_INDEX_DIR, site.unthrottled.devtoolsLogPath);
process.env.LANTERN_DEBUG = 'true';
execFileSync('node', ['--inspect-brk', RUN_ONCE_PATH, trace, log], {stdio: 'inherit'});
View on GitHub (pinned to 9515cd4e58)
Solutions
- Provide a URL as the first positional argument: `node core/scripts/lantern/debug-url.js https://example.com`
- Ensure the URL must exactly match a site.url in the site index JSON
Defensive patterns
Strategy: validation
Validate before calling
const INPUT_URL = process.argv[2];
if (!INPUT_URL) {
console.error('Usage: node debug-url.js <url>');
process.exit(1);
} Prevention
- Always provide the URL as the first positional argument
- Use a shell wrapper or npm script that validates arguments before invoking
When it happens
Trigger: Running `node core/scripts/lantern/debug-url.js` with no arguments, or with arguments that don't reach argv[2] (e.g., flags parsed before the URL). process.argv[2] is undefined.
Common situations: Forgetting the URL argument. Copy-paste error in a command. Running the script through a wrapper that doesn't forward positional arguments.
Related errors
- Usage $0 <computed summary file>
- Usage $0 <expectations file>
- Invalid precomputed lantern data file
- Please provide a url
- Could not find with site URL ${INPUT_URL}
AI-assisted analysis of GoogleChrome/lighthouse@9515cd4e58 (2026-08-13).
Data as JSON: /api/errors/924cbd0a4cf4d4c3.
Report an issue: GitHub.