koala73/worldmonitor · error

--report requires exactly one path

Error message

--report requires exactly one path

What it means

reportPathFromArgs() validates that '--report' appears exactly once and is followed by exactly one non-empty path value. If it's repeated or followed by nothing (end of args) or an empty string, it throws '--report requires exactly one path'.

Solutions

  1. Supply exactly one path: --report ./mcp-smoke-report.json
  2. Ensure the value is not empty — check that any shell variable holding it is set
  3. Remove duplicate --report flags, keeping only one

Example fix

// before
node scripts/mcp-live-smoke.mjs --report
// after
node scripts/mcp-live-smoke.mjs --report ./mcp-smoke-report.json
Defensive patterns

Strategy: validation

Validate before calling

const idx = args.indexOf('--report');
if (idx !== -1 && (!args[idx + 1] || args[idx + 1].startsWith('--'))) throw new Error('--report requires exactly one path');

Type guard

null

Try / catch

try {
  const reportPath = reportPathFromArgs(process.argv.slice(2));
} catch (err) {
  if (err.message.includes('--report')) console.error('Provide exactly one: --report <path>');
  process.exit(2);
}

Prevention

When it happens

Trigger: Calling the script with --report and no value (last argument), with --report followed by another flag starting with '--', or with --report given twice (second occurrence sees reportPath !== null).

Common situations: Shell variable expansion producing an empty value ($REPORT_PATH unset), copy-paste duplicating the flag, or forgetting the path argument entirely.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22). Data as JSON: /api/errors/afc0d59b314af08c. Report an issue: GitHub.

Appendix: source

Thrown at scripts/mcp-live-smoke.mjs:815

  checks += 1;
  try {
    const { res } = await timedFetch(`${host}/mcp`, { method: 'OPTIONS' }, { group: 'aliases' });
    if (res.status !== 204) {
      fail(host, 'OPTIONS /mcp CORS', `expected 204, got ${res.status}`);
    } else {
      ok(host, 'OPTIONS /mcp CORS', '204');
    }
  } catch (err) {
    throwIfRunBudgetExhausted(err);
    fail(host, 'OPTIONS /mcp CORS', `HANG/transport error: ${formatSafeError(err)}`);
  }
}

function reportPathFromArgs(args) {
  let reportPath = null;
  for (let index = 0; index < args.length; index += 1) {
    if (args[index] !== '--report') throw new Error(`Unknown argument: ${args[index]}`);
    if (reportPath !== null || !args[index + 1]) throw new Error('--report requires exactly one path');
    reportPath = args[index + 1];
    index += 1;
  }
  return reportPath;
}

function checkedOutSha() {
  try {
    return execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();
  } catch {
    return null;
  }
}

function writeReport(reportPath, completedAllGroups) {
  if (!reportPath) return true;
  const report = {
    version: 'mcp_live_smoke_report/v1',

View on GitHub (pinned to e586b8b4b8)