{"record":{"id":"8f37d36779172426","repo":"koala73/worldmonitor","slug":"get-needs-an-api-path-e-g-worldmonitor-get-a","errorCode":null,"errorMessage":"`get` needs an API path, e.g. `worldmonitor get /api/health`","messagePattern":"`get` needs an API path, e\\.g\\. `worldmonitor get /api/health`","errorType":"exception","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"cli/src/core.mjs","lineNumber":267,"sourceCode":"// Throws UsageError for malformed input.\nexport function planRequest(parsed, config = {}) {\n  const { command, positionals, options, params } = parsed;\n\n  if (command === 'list' || command === 'endpoints') {\n    return {\n      kind: 'list',\n      specUrl: options.specUrl || config.specUrl || DEFAULT_SPEC_URL,\n      service: positionals[0],\n    };\n  }\n\n  if (command === 'health') {\n    return restPlan('/api/health', {}, options, config);\n  }\n  if (command === 'get') {\n    const path = positionals[0];\n    if (!path || !path.startsWith('/')) {\n      throw new UsageError('`get` needs an API path, e.g. `worldmonitor get /api/health`');\n    }\n    return restPlan(path, params, options, config);\n  }\n\n  if (command === 'tools') return mcpPlan('tools/list', undefined, options, config);\n  if (command === 'prompts') return mcpPlan('prompts/list', undefined, options, config);\n  if (command === 'resources') return mcpPlan('resources/list', undefined, options, config);\n\n  if (command === 'call') {\n    const tool = positionals[0];\n    if (!tool) {\n      throw new UsageError(\n        '`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`',\n      );\n    }\n    return mcpPlan('tools/call', { name: tool, arguments: collectArgs(parsed) }, options, config, {\n      needsKey: true,\n    });","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/cli/src/core.mjs#L249-L285","documentation":"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).","triggerScenarios":"`worldmonitor get` with no positional; `worldmonitor get api/health` (no leading slash); `worldmonitor get health`; an option value consuming the path slot.","commonSituations":"Copying a path from the browser UI that omits the leading slash; muscle memory from other CLIs that accept bare relative paths.","solutions":["Pass the full API path with a leading slash: worldmonitor get /api/health","Discover valid paths first with `worldmonitor list` (flattened OpenAPI operations)"],"exampleFix":"# before\nworldmonitor get api/health        # UsageError\nworldmonitor get                   # UsageError\n\n# after\nworldmonitor get /api/health","handlingStrategy":"validation","validationCode":"// Guard the positional before invoking the CLI\nfunction validGetPath(p) {\n  return typeof p === 'string' && p.startsWith('/');\n}\nif (!validGetPath(path)) throw new Error('get: path must start with /');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source paths from `worldmonitor list` output rather than typing them","In scripts, assert the leading slash before invoking get"],"tags":["cli","usage","arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}