{"record":{"id":"e85e2230de31a0b7","repo":"stablyai/orca","slug":"invalid-argument","errorCode":"invalid_argument","errorMessage":"Unknown command: ${parsed.commandPath.join(' ')}","messagePattern":"Unknown command: (.+?)","errorType":"validation","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/args.ts","lineNumber":284,"sourceCode":"        }\n      })\n      return { commandPath: spec.path, flags, positionalFlagConflicts }\n    }\n  }\n  return parsed\n}\n\nexport function findCommandSpec(\n  specs: CommandSpec[],\n  commandPath: string[]\n): CommandSpec | undefined {\n  return specs.find((spec) => specPaths(spec).some((candidate) => matches(candidate, commandPath)))\n}\n\nexport function validateCommandAndFlags(specs: CommandSpec[], parsed: ParsedArgs): void {\n  const spec = findCommandSpec(specs, parsed.commandPath)\n  if (!spec) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      `Unknown command: ${parsed.commandPath.join(' ')}`,\n      unknownCommandData(specs, parsed.commandPath)\n    )\n  }\n\n  if (parsed.positionalFlagConflicts && parsed.positionalFlagConflicts.length > 0) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      `Pass ${parsed.positionalFlagConflicts\n        .map((flag) => `--${flag}`)\n        .join(', ')} either positionally or as a flag, not both.`\n    )\n  }\n\n  const pageAllowed = supportsBrowserPageFlag(spec.path)\n  for (const [flag, value] of parsed.flags) {\n    const isGlobalFlag = GLOBAL_FLAGS.includes(flag)","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/args.ts#L266-L302","documentation":"Thrown by validateCommandAndFlags (args.ts:284) with code 'invalid_argument' when findCommandSpec returns no match — the parsed command path (e.g. ['foo','bar']) does not match any CommandSpec path or alias. The error data (unknownCommandData) typically lists the closest/supported commands to help the user.","triggerScenarios":"Invoking the CLI with a command token that is not registered: a typo ('agnt' instead of 'agent'), a removed command, a subcommand under the wrong parent, or an extra positional that turns a valid command into an unrecognized path.","commonSituations":"Version mismatch (command renamed/removed between releases); misspelled command; user assumes a subcommand exists where it does not; extra trailing token misinterpreted as part of the path.","solutions":["Run the CLI with --help (or list the top-level commands) to see the registered command set for your version.","Correct the typo or use the exact registered command path.","If the command was renamed in a newer version, update your usage/scripts to the new name."],"exampleFix":"// before\n$ opencode agnt run\n// after\n$ opencode agent run","handlingStrategy":"type-guard","validationCode":"import { findCommandSpec } from './args'\n\nconst spec = findCommandSpec(specs, parsed.commandPath)\nif (!spec) {\n  throw new Error(`Unknown command. Valid: ${specs.map(s => s.path.join(' ')).join(', ')}`)\n}","typeGuard":"const isValidCommand = (specs: CommandSpec[], path: string[]): boolean =>\n  findCommandSpec(specs, path) !== undefined","tryCatchPattern":"try {\n  validateCommandAndFlags(specs, parsed)\n} catch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && /Unknown command/.test(e.message)) {\n    // show help / suggest closest command\n  } else throw\n}","preventionTips":["Generate CLI invocations from the registered command specs, not hardcoded strings.","Version-pin the CLI binary to match the documented command set.","Show available commands in your shell wrapper when an unknown command is entered."],"tags":["cli","typescript","input-validation","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}