{"record":{"id":"54853d52f7fe3982","repo":"stablyai/orca","slug":"invalid-argument-54853d","errorCode":"invalid_argument","errorMessage":"--scope must be \"isolated\" or \"imported\"","messagePattern":"--scope must be \"isolated\" or \"imported\"","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/browser-profile.ts","lineNumber":28,"sourceCode":"import { getOptionalStringFlag, getRequiredStringFlag } from '../flags'\nimport {\n  formatBrowserProfileList,\n  formatTabProfileClone,\n  formatTabProfileShow,\n  printResult\n} from '../format'\nimport { RuntimeClientError } from '../runtime-client'\nimport { getBrowserCommandTarget } from '../selectors'\n\nfunction parseScopeFlag(flags: Map<string, string | boolean>): 'isolated' | 'imported' {\n  const raw = getOptionalStringFlag(flags, 'scope')\n  if (raw === undefined || raw === 'isolated') {\n    return 'isolated'\n  }\n  if (raw === 'imported') {\n    return 'imported'\n  }\n  throw new RuntimeClientError('invalid_argument', '--scope must be \"isolated\" or \"imported\"')\n}\n\nexport const BROWSER_PROFILE_HANDLERS: Record<string, CommandHandler> = {\n  'tab profile list': async ({ client, json }) => {\n    const result = await client.call<BrowserProfileListResult>('browser.profileList')\n    printResult(result, json, formatBrowserProfileList)\n  },\n  'tab profile create': async ({ flags, client, json }) => {\n    const label = getRequiredStringFlag(flags, 'label')\n    const scope = parseScopeFlag(flags)\n    const result = await client.call<BrowserProfileCreateResult>('browser.profileCreate', {\n      label,\n      scope,\n      ...(flags.get('no-ua-spoof') === true ? { userAgentMode: 'native' } : {})\n    })\n    if (result.result.profile === null) {\n      // Why: registry refuses non-isolated/imported scopes; we already validated\n      // the scope client-side, so a null here means a server-side rejection we","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/browser-profile.ts#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Guessing a scope name from another browser tool's vocabulary ('shared', 'incognito'), a typo, or passing 'import' instead of 'imported'.","solutions":["Use `--scope isolated` (default) for a clean profile, or `--scope imported` to import the main profile's data.","Omit --scope entirely to get the 'isolated' default.","Check spelling — 'imported' not 'import'."],"exampleFix":"// before\norca tab profile create --label ci --scope shared\n// after\norca tab profile create --label ci --scope isolated","handlingStrategy":"validation","validationCode":"function parseScope(raw: string | undefined): 'isolated' | 'imported' {\n  if (raw === undefined || raw === 'isolated') return 'isolated'\n  if (raw === 'imported') return 'imported'\n  throw new Error(`--scope must be 'isolated' or 'imported', got ${raw}`)\n}","typeGuard":"function isProfileScope(v: string): v is 'isolated' | 'imported' {\n  return v === 'isolated' || v === 'imported'\n}","tryCatchPattern":null,"preventionTips":["Use the exact tokens 'isolated'/'imported' (not 'import' or 'shared').","Omit --scope to accept the isolated default when unsure.","Validate scope in wrapper scripts before invoking tab profile create."],"tags":["cli","browser","profile","flag-validation","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}