koala73/worldmonitor · error
Unknown argument
Error message
Unknown argument: ${args[index]} What it means
reportPathFromArgs() accepts exactly one CLI flag form: --report <path>. Any argument that is not the literal '--report' throws 'Unknown argument: <arg>'. This is a strict allow-list parser so typos and unsupported flags fail loudly instead of being silently ignored.
Solutions
- Use --report <path> to supply the report location
- Remove any unexpected positional or extra arguments from the command line
- Check the script's usage docs for the supported flag set
- Fix the flag spelling (e.g. --repport -> --report)
Example fix
// before node scripts/mcp-live-smoke.mjs --out report.json // after node scripts/mcp-live-smoke.mjs --report report.json
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['--report']);
for (const a of process.argv.slice(2)) {
if (a !== '--report' && !ALLOWED.has(a)) throw new Error(`Unknown argument: ${a}`);
} Type guard
null
Try / catch
try {
const reportPath = reportPathFromArgs(process.argv.slice(2));
} catch (err) {
if (err.message.startsWith('Unknown argument')) console.error(`Usage: --report <path>. ${err.message}`);
process.exit(2);
} Prevention
- Only pass --report <path> to mcp-live-smoke.mjs
- Double-check flag spelling when copying commands from other scripts
- Read the script's usage docs before adding flags
When it happens
Trigger: Running node scripts/mcp-live-smoke.mjs --output ./report.json (wrong flag name), a positional argument like a host name, or a mistyped flag such as --report=./x.json (parsed as one token).
Common situations: Developers copying flags from other smoke/merge scripts (e.g. --file or --execute from merge-train.mjs), typos like --repport, or passing extra positional args after the flag pair.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- --report requires exactly one path
- `call` needs a tool name, e.g. `worldmonitor call…
- ` ` needs < >. Usage: worldmonitor < >
- `get` needs an API path, e.g. `worldmonitor get /api/health`
- No PR numbers given
AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22).
Data as JSON: /api/errors/957846220520e620.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/mcp-live-smoke.mjs:814
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 = {View on GitHub (pinned to e586b8b4b8)