stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

Missing value for --expires.

What it means

Thrown by getOptionalCookieExpiry in the browser-cookie handler when the --expires flag is present but its value is not a usable string: either the flag was given as a bare boolean (--expires with no value, stored as `true`) or the value is an empty string. The flag is optional, so the guard only runs once `flags.has('expires')` is true.

Source

Thrown at src/cli/handlers/browser-cookie.ts:18

import type {
  BrowserCookieDeleteResult,
  BrowserCookieGetResult,
  BrowserCookieSetResult
} from '../../shared/runtime-types'
import type { CommandHandler } from '../dispatch'
import { printResult } from '../format'
import { getOptionalStringFlag, getRequiredStringFlag } from '../flags'
import { RuntimeClientError } from '../runtime-client'
import { getBrowserCommandTarget } from '../selectors'

function getOptionalCookieExpiry(flags: Map<string, string | boolean>): number | undefined {
  if (!flags.has('expires')) {
    return undefined
  }
  const rawExpires = flags.get('expires')
  if (typeof rawExpires !== 'string' || rawExpires.length === 0) {
    throw new RuntimeClientError('invalid_argument', 'Missing value for --expires.')
  }
  const expires = Number(rawExpires)
  if (!Number.isFinite(expires) || expires < 0) {
    throw new RuntimeClientError('invalid_argument', `Invalid --expires value: ${rawExpires}`)
  }
  return expires
}

export const BROWSER_COOKIE_HANDLERS: Record<string, CommandHandler> = {
  'cookie get': async ({ flags, client, cwd, json }) => {
    const url = getOptionalStringFlag(flags, 'url')
    const target = await getBrowserCommandTarget(flags, cwd, client)
    const result = await client.call<BrowserCookieGetResult>('browser.cookie.get', {
      url,
      ...target
    })
    printResult(result, json, (v) => {
      if (v.cookies.length === 0) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Provide a numeric expiry value: `--expires <ms>` (a non-negative number).
  2. If using shell variable expansion, ensure the variable is set and non-empty, or drop --expires entirely to omit the expiry.
  3. Double-check there is no `=` with nothing after it and that --expires is not the last token.

Example fix

// before
orca cookie set --url https://x --name sid --value v --expires
// after
orca cookie set --url https://x --name sid --value v --expires 3600000
Defensive patterns

Strategy: validation

Validate before calling

function readExpiresFlag(flags: Map<string, string | boolean>): string | undefined {
  if (!flags.has('expires')) return undefined
  const v = flags.get('expires')
  if (typeof v !== 'string' || v.length === 0) {
    throw new Error('--expires requires a numeric value')
  }
  return v
}

Prevention

When it happens

Trigger: Invoking `cookie get`/`cookie set` (BROWSER_COOKIE_HANDLERS) with `--expires` but no following token, e.g. `--expires` at end of line or `--expires=` (empty). typeof rawExpires !== 'string' || length === 0 evaluates true.

Common situations: Quoting/escaping mistakes that drop the value, a flag alias that maps --expires to a boolean toggle, or shell expansion of an unset variable producing an empty string (e.g. `--expires=$EXPIRES` with EXPIRES unset).

Related errors


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