koala73/worldmonitor · error · UsageError
`get` needs an API path, e.g. `worldmonitor get /api/health`
Error message
`get` needs an API path, e.g. `worldmonitor get /api/health`
What it means
The `get` command proxies an arbitrary WorldMonitor REST path. planRequest requires the first positional argument to exist and start with '/' so the target path is unambiguous; otherwise it raises this UsageError before any request is made (exit code 2).
Source
Thrown at cli/src/core.mjs:267
// Throws UsageError for malformed input.
export function planRequest(parsed, config = {}) {
const { command, positionals, options, params } = parsed;
if (command === 'list' || command === 'endpoints') {
return {
kind: 'list',
specUrl: options.specUrl || config.specUrl || DEFAULT_SPEC_URL,
service: positionals[0],
};
}
if (command === 'health') {
return restPlan('/api/health', {}, options, config);
}
if (command === 'get') {
const path = positionals[0];
if (!path || !path.startsWith('/')) {
throw new UsageError('`get` needs an API path, e.g. `worldmonitor get /api/health`');
}
return restPlan(path, params, options, config);
}
if (command === 'tools') return mcpPlan('tools/list', undefined, options, config);
if (command === 'prompts') return mcpPlan('prompts/list', undefined, options, config);
if (command === 'resources') return mcpPlan('resources/list', undefined, options, config);
if (command === 'call') {
const tool = positionals[0];
if (!tool) {
throw new UsageError(
'`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`',
);
}
return mcpPlan('tools/call', { name: tool, arguments: collectArgs(parsed) }, options, config, {
needsKey: true,
});View on GitHub (pinned to eeab0a219f)
Solutions
- Pass the full API path with a leading slash: worldmonitor get /api/health
- Discover valid paths first with `worldmonitor list` (flattened OpenAPI operations)
Example fix
# before worldmonitor get api/health # UsageError worldmonitor get # UsageError # after worldmonitor get /api/health
Defensive patterns
Strategy: validation
Validate before calling
// Guard the positional before invoking the CLI
function validGetPath(p) {
return typeof p === 'string' && p.startsWith('/');
}
if (!validGetPath(path)) throw new Error('get: path must start with /'); Prevention
- Source paths from `worldmonitor list` output rather than typing them
- In scripts, assert the leading slash before invoking get
When it happens
Trigger: `worldmonitor get` with no positional; `worldmonitor get api/health` (no leading slash); `worldmonitor get health`; an option value consuming the path slot.
Common situations: Copying a path from the browser UI that omits the leading slash; muscle memory from other CLIs that accept bare relative paths.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- `call` needs a tool name, e.g. `worldmonitor call get_countr
- `${command}` needs <${a.name}>. Usage: worldmonitor ${comman
- --args must be valid JSON: ${err.message}
- Unknown command: ${command || '(none)'}. Run `worldmonitor -
- global fetch is unavailable — Node 18+ is required
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/8f37d36779172426.
Report an issue: GitHub.