koala73/worldmonitor · error · UsageError
Unknown command: ${command || '(none)'}. Run `worldmonitor -
Error message
Unknown command: ${command || '(none)'}. Run `worldmonitor --help`. What it means
planRequest falls through every known command (health, get, tools, prompts, resources, call, and the curated set); anything else raises UsageError pointing at --help, with '(none)' shown when the command slot is empty at this branch. Exit code 2.
Source
Thrown at cli/src/core.mjs:305
if (Object.hasOwn(CURATED_COMMANDS, command)) {
const spec = CURATED_COMMANDS[command];
const args = {};
for (const [k, v] of Object.entries(params)) args[k] = v === true ? true : String(v);
spec.args.forEach((a, idx) => {
if (positionals[idx] !== undefined) args[a.name] = positionals[idx];
});
for (const a of spec.args) {
if (a.required && args[a.name] === undefined) {
throw new UsageError(`\`${command}\` needs <${a.name}>. Usage: worldmonitor ${command} <${a.name}>`);
}
}
return mcpPlan('tools/call', { name: spec.tool, arguments: args }, options, config, {
needsKey: true,
});
}
throw new UsageError(`Unknown command: ${command || '(none)'}. Run \`worldmonitor --help\`.`);
}
export function formatOutput(value, options = {}) {
if (options.raw && typeof value === 'string') return value;
if (options.compact) return JSON.stringify(value);
return JSON.stringify(value, null, 2);
}
// Flatten an OpenAPI document into printable operation rows, optionally scoped
// to one service (the first path segment after /api/).
export function summarizeSpec(spec, serviceFilter) {
const paths = (spec && spec.paths) || {};
const rows = [];
for (const p of Object.keys(paths).sort()) {
const match = p.match(/^\/api\/([^/]+)\/v\d+\//);
const service = match ? match[1] : '(other)';
if (serviceFilter && service !== serviceFilter) continue;
for (const method of Object.keys(paths[p])) {View on GitHub (pinned to eeab0a219f)
Solutions
- Run `worldmonitor --help` and copy an exact command name
- Check the changelog/release notes for renamed or removed commands
- Update the CLI package to the latest version if the command should exist
- Echo the exact argv in the failing script to expose hidden characters
Example fix
# before $ worldmonitor helth # Error: Unknown command: helth. Run `worldmonitor --help`. # after $ worldmonitor --help # list valid commands, then use one exactly $ worldmonitor health
Defensive patterns
Strategy: validation
Validate before calling
// Whitelist commands before dispatching in scripts
const KNOWN = new Set(['health', 'get', 'tools', 'prompts', 'resources', 'call', /* curated... */]);
if (!KNOWN.has(command)) {
console.error(`Unknown command: ${command}. Valid: ${[...KNOWN].join(', ')}`);
process.exit(2);
} Prevention
- Parse `worldmonitor --help` in wrappers to keep the valid-command set in sync
- Pin the CLI version in CI so command renames surface as review diffs, not runtime errors
When it happens
Trigger: Typos (helth, tool); retired command names after an upgrade; a command that only exists in a newer CLI version; invisible characters from copy-paste; flags placed where the command belongs.
Common situations: Scripts pinned to old command names after an upgrade; shell completion inserting the wrong token; locale/keyboard typos.
Related errors
- --args must be valid JSON: ${err.message}
- `get` needs an API path, e.g. `worldmonitor get /api/health`
- `call` needs a tool name, e.g. `worldmonitor call get_countr
- `${command}` needs <${a.name}>. Usage: worldmonitor ${comman
- global fetch is unavailable — Node 18+ is required
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/fbb4fa18728883e9.
Report an issue: GitHub.