{"record":{"id":"555bfaa989cc9d24","repo":"stablyai/orca","slug":"runtime-error-555bfa","errorCode":"runtime_error","errorMessage":"Failed to create browser profile (label=${label}, scope=${scope})","messagePattern":"Failed to create browser profile \\(label=(.+?), scope=(.+?)\\)","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/browser-profile.ts","lineNumber":48,"sourceCode":"\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\n      // shouldn't silently report as success.\n      throw new RuntimeClientError(\n        'runtime_error',\n        `Failed to create browser profile (label=${label}, scope=${scope})`\n      )\n    }\n    printResult(\n      result,\n      json,\n      (value) =>\n        `Created profile ${value.profile?.id ?? 'unknown'} (${value.profile?.label ?? label})`\n    )\n  },\n  'tab profile delete': async ({ flags, client, json }) => {\n    const profileId = getRequiredStringFlag(flags, 'profile')\n    const result = await client.call<BrowserProfileDeleteResult>('browser.profileDelete', {\n      profileId\n    })\n    printResult(result, json, (value) =>\n      value.deleted","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/browser-profile.ts#L30-L66","documentation":"Thrown by the `tab profile create` handler when browser.profileCreate succeeds at the transport level but returns `result.result.profile === null`. Because the client already validated the scope, a null profile indicates a server-side rejection (registry refused the combination) that must not be reported as success. Note the code is runtime_error, not invalid_argument — this is a server-side failure surfaced upward, distinct from the client flag errors.","triggerScenarios":"Calling browser.profileCreate with a label/scope combination the server-side profile registry rejects (e.g. an imported-profile constraint the server enforces that the client does not pre-check, or a registry capacity/permission issue), so the RPC returns a non-throwing response with profile: null.","commonSituations":"Server build newer/older than the client with a different accepted scope set; the 'imported' scope disabled by policy/config on the host; a transient registry lock or permission issue on the profile store. The existing inline comment explicitly flags this as a server-side rejection path.","solutions":["Retry with --scope isolated (the most permissive scope) to confirm the server accepts profile creation at all.","Check the server/host logs for the registry rejection reason behind the null profile.","Verify client and server versions are compatible for the profileCreate contract and that the 'imported' scope is enabled on the host if you used it.","If the rejection persists, report the label/scope pair to the host operator rather than treating it as a client flag fix."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isCreatedProfile(r: BrowserProfileCreateResult | undefined): r is { profile: { id: string; label: string } } {\n  return !!r && r.profile !== null && typeof r.profile?.id === 'string'\n}","tryCatchPattern":"try {\n  const result = await client.call('browser.profileCreate', { label, scope, ... })\n  if (result.result.profile === null) {\n    // server rejected; surface a actionable message and fall back to isolated scope\n    throw new Error(`server refused profile (label=${label}, scope=${scope}); retry with --scope isolated`)\n  }\n} catch (err) {\n  if (String(err).includes('Failed to create browser profile')) {\n    // retry once with isolated scope, then surface host logs\n  }\n  throw err\n}","preventionTips":["Default to --scope isolated when creating profiles programmatically; it is the most permissive.","Confirm host and client versions agree on the profileCreate contract before relying on 'imported'.","On a null-profile response, inspect host logs for the registry rejection reason before retrying."],"tags":["cli","browser","profile","runtime-error","server-rejection"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}