stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

Unknown command: ${parsed.commandPath.join(' ')}

What it means

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.

Source

Thrown at src/cli/args.ts:284

        }
      })
      return { commandPath: spec.path, flags, positionalFlagConflicts }
    }
  }
  return parsed
}

export function findCommandSpec(
  specs: CommandSpec[],
  commandPath: string[]
): CommandSpec | undefined {
  return specs.find((spec) => specPaths(spec).some((candidate) => matches(candidate, commandPath)))
}

export function validateCommandAndFlags(specs: CommandSpec[], parsed: ParsedArgs): void {
  const spec = findCommandSpec(specs, parsed.commandPath)
  if (!spec) {
    throw new RuntimeClientError(
      'invalid_argument',
      `Unknown command: ${parsed.commandPath.join(' ')}`,
      unknownCommandData(specs, parsed.commandPath)
    )
  }

  if (parsed.positionalFlagConflicts && parsed.positionalFlagConflicts.length > 0) {
    throw new RuntimeClientError(
      'invalid_argument',
      `Pass ${parsed.positionalFlagConflicts
        .map((flag) => `--${flag}`)
        .join(', ')} either positionally or as a flag, not both.`
    )
  }

  const pageAllowed = supportsBrowserPageFlag(spec.path)
  for (const [flag, value] of parsed.flags) {
    const isGlobalFlag = GLOBAL_FLAGS.includes(flag)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Run the CLI with --help (or list the top-level commands) to see the registered command set for your version.
  2. Correct the typo or use the exact registered command path.
  3. If the command was renamed in a newer version, update your usage/scripts to the new name.

Example fix

// before
$ opencode agnt run
// after
$ opencode agent run
Defensive patterns

Strategy: type-guard

Validate before calling

import { findCommandSpec } from './args'

const spec = findCommandSpec(specs, parsed.commandPath)
if (!spec) {
  throw new Error(`Unknown command. Valid: ${specs.map(s => s.path.join(' ')).join(', ')}`)
}

Type guard

const isValidCommand = (specs: CommandSpec[], path: string[]): boolean =>
  findCommandSpec(specs, path) !== undefined

Try / catch

try {
  validateCommandAndFlags(specs, parsed)
} catch (e) {
  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && /Unknown command/.test(e.message)) {
    // show help / suggest closest command
  } else throw
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/e85e2230de31a0b7. Report an issue: GitHub.