stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

--direction must be "up" or "down"

What it means

Thrown by the `browser-nav scroll` handler when --direction is set to anything other than the literal 'up' or 'down'. The scroll command only supports vertical directions in this handler, so left/right/empty/garbage are rejected client-side before browser.scroll is called.

Source

Thrown at src/cli/handlers/browser-nav.ts:83

  },
  forward: async ({ flags, client, cwd, json }) => {
    const target = await getBrowserCommandTarget(flags, cwd, client)
    const result = await client.call<unknown>('browser.forward', target)
    printResult(result, json, (v) => {
      const url = (v as { url?: string } | null | undefined)?.url
      return url ? `Navigated forward to ${url}` : 'Navigated forward'
    })
  },
  eval: async ({ flags, client, cwd, json }) => {
    const expression = getRequiredStringFlag(flags, 'expression')
    const target = await getBrowserCommandTarget(flags, cwd, client)
    const result = await client.call<BrowserEvalResult>('browser.eval', { expression, ...target })
    printResult(result, json, (v) => v.result)
  },
  scroll: async ({ flags, client, cwd, json }) => {
    const direction = getRequiredStringFlag(flags, 'direction')
    if (direction !== 'up' && direction !== 'down') {
      throw new RuntimeClientError('invalid_argument', '--direction must be "up" or "down"')
    }
    const amount = getOptionalPositiveIntegerFlag(flags, 'amount')
    const target = await getBrowserCommandTarget(flags, cwd, client)
    const result = await client.call<BrowserScrollResult>('browser.scroll', {
      direction,
      amount,
      ...target
    })
    printResult(result, json, (v) => `Scrolled ${v.scrolled}`)
  },
  wait: async ({ flags, client, cwd, json }) => {
    const selector = getOptionalStringFlag(flags, 'selector')
    const timeout = getOptionalPositiveIntegerFlag(flags, 'timeout')
    const text = getOptionalStringFlag(flags, 'text')
    const url = getOptionalStringFlag(flags, 'url')
    const load = getOptionalStringFlag(flags, 'load')
    const fn = getOptionalStringFlag(flags, 'fn')
    const state = getOptionalStringFlag(flags, 'state')

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Use exactly `--direction up` or `--direction down` (lowercase).
  2. For horizontal scrolling, use the computer-action scroll command (validateScrollDirection accepts left/right) instead of browser-nav scroll.
  3. Check for trailing whitespace or capitalization in the value.

Example fix

// before
orca browser-nav scroll --direction left --amount 100
// after
orca browser-nav scroll --direction down --amount 100
Defensive patterns

Strategy: validation

Validate before calling

function parseScrollDirection(raw: string): 'up' | 'down' {
  if (raw !== 'up' && raw !== 'down') {
    throw new Error(`browser-nav scroll direction must be 'up' or 'down', got ${raw}`)
  }
  return raw
}

Type guard

function isVerticalDirection(v: string): v is 'up' | 'down' {
  return v === 'up' || v === 'down'
}

Prevention

When it happens

Trigger: Running `browser-nav scroll --direction left` (or 'right', 'top', '', etc.). getRequiredStringFlag('direction') returns the value and the `!== 'up' && !== 'down'` check throws.

Common situations: Confusing this scroll handler (vertical-only) with the broader computer-action scroll which supports left/right via validateScrollDirection. Typo like 'Down' (capitalized) or passing an amount as the direction.

Related errors


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