stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

--scope must be "isolated" or "imported"

What it means

Thrown by parseScopeFlag when --scope is set to any value other than 'isolated' or 'imported'. Browser profiles in Orca are either isolated (fresh, self-contained) or imported (share the user's main profile data); no other scope mode exists, so anything else is rejected before browser.profileCreate is called.

Source

Thrown at src/cli/handlers/browser-profile.ts:28

import { getOptionalStringFlag, getRequiredStringFlag } from '../flags'
import {
  formatBrowserProfileList,
  formatTabProfileClone,
  formatTabProfileShow,
  printResult
} from '../format'
import { RuntimeClientError } from '../runtime-client'
import { getBrowserCommandTarget } from '../selectors'

function parseScopeFlag(flags: Map<string, string | boolean>): 'isolated' | 'imported' {
  const raw = getOptionalStringFlag(flags, 'scope')
  if (raw === undefined || raw === 'isolated') {
    return 'isolated'
  }
  if (raw === 'imported') {
    return 'imported'
  }
  throw new RuntimeClientError('invalid_argument', '--scope must be "isolated" or "imported"')
}

export const BROWSER_PROFILE_HANDLERS: Record<string, CommandHandler> = {
  'tab profile list': async ({ client, json }) => {
    const result = await client.call<BrowserProfileListResult>('browser.profileList')
    printResult(result, json, formatBrowserProfileList)
  },
  'tab profile create': async ({ flags, client, json }) => {
    const label = getRequiredStringFlag(flags, 'label')
    const scope = parseScopeFlag(flags)
    const result = await client.call<BrowserProfileCreateResult>('browser.profileCreate', {
      label,
      scope,
      ...(flags.get('no-ua-spoof') === true ? { userAgentMode: 'native' } : {})
    })
    if (result.result.profile === null) {
      // Why: registry refuses non-isolated/imported scopes; we already validated
      // the scope client-side, so a null here means a server-side rejection we

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Use `--scope isolated` (default) for a clean profile, or `--scope imported` to import the main profile's data.
  2. Omit --scope entirely to get the 'isolated' default.
  3. Check spelling — 'imported' not 'import'.

Example fix

// before
orca tab profile create --label ci --scope shared
// after
orca tab profile create --label ci --scope isolated
Defensive patterns

Strategy: validation

Validate before calling

function parseScope(raw: string | undefined): 'isolated' | 'imported' {
  if (raw === undefined || raw === 'isolated') return 'isolated'
  if (raw === 'imported') return 'imported'
  throw new Error(`--scope must be 'isolated' or 'imported', got ${raw}`)
}

Type guard

function isProfileScope(v: string): v is 'isolated' | 'imported' {
  return v === 'isolated' || v === 'imported'
}

Prevention

When it happens

Trigger: Running `tab profile create --label x --scope shared` (or 'persistent', 'private', '', etc.). getOptionalStringFlag('scope') returns the value, neither 'isolated' nor 'imported' matches, and the throw fires.

Common situations: Guessing a scope name from another browser tool's vocabulary ('shared', 'incognito'), a typo, or passing 'import' instead of 'imported'.

Related errors


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