stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

Missing required --${name}

What it means

Thrown by getRequiredStringFlag when the named flag is absent, present as a boolean (valueless), or present as an empty string. This variant demands a non-empty string value, so it rejects `--name` with no argument and `--name ''`. It is the strictest of the string-flag helpers and is used for flags where an empty value is semantically invalid (e.g. op, permission).

Source

Thrown at src/cli/flags.ts:9

import { RuntimeClientError } from './runtime/types'
import { REPEATED_FLAG_SEPARATOR } from './args'

export function getRequiredStringFlag(flags: Map<string, string | boolean>, name: string): string {
  const value = flags.get(name)
  if (typeof value === 'string' && value.length > 0) {
    return value
  }
  throw new RuntimeClientError('invalid_argument', `Missing required --${name}`)
}

export function getRequiredStringFlagAllowingEmpty(
  flags: Map<string, string | boolean>,
  name: string
): string {
  const value = flags.get(name)
  if (typeof value === 'string') {
    return value
  }
  throw new RuntimeClientError('invalid_argument', `Missing required --${name}`)
}

export function getOptionalStringFlag(
  flags: Map<string, string | boolean>,
  name: string
): string | undefined {
  const value = flags.get(name)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Provide the flag with a non-empty value: `--<name> value`.
  2. If an empty string is legitimately valid for your flag, use getRequiredStringFlagAllowingEmpty instead.
  3. If the flag is optional, use getOptionalStringFlag.

Example fix

// before
getRequiredStringFlag(flags, 'permission')  // flags has no 'permission'

// after
getRequiredStringFlag(new Map([...flags, ['permission','CAMERA']]), 'permission')
Defensive patterns

Strategy: type-guard

Validate before calling

function requireNonEmptyFlag(flags: Map<string, string | boolean>, name: string): string {
  const v = flags.get(name)
  if (typeof v !== 'string' || v.length === 0) {
    throw new Error(`--${name} requires a non-empty string value`)
  }
  return v
}

Type guard

function isNonEmptyStringFlag(flags: Map<string, string | boolean>, name: string): boolean {
  const v = flags.get(name)
  return typeof v === 'string' && v.length > 0
}

Try / catch

try {
  getRequiredStringFlag(flags, name)
} catch (e) {
  if (e instanceof RuntimeClientError && e.code === 'invalid_argument') {
    // prompt for the missing --name value
  }
  throw e
}

Prevention

When it happens

Trigger: flags.get(name) returns undefined, true (a valueless boolean flag), or '' (empty string). This happens when the flag was not parsed, was passed without a value, or was explicitly set to empty.

Common situations: A required flag like --op or --permission is omitted entirely, written as a bare `--flag`, or given an empty argument due to shell quoting gone wrong (`--permission ""`).

Related errors


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