{"record":{"id":"626111bb72677672","repo":"stablyai/orca","slug":"invalid-argument-626111","errorCode":"invalid_argument","errorMessage":"Missing value for --expires.","messagePattern":"Missing value for --expires\\.","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/browser-cookie.ts","lineNumber":18,"sourceCode":"import type {\n  BrowserCookieDeleteResult,\n  BrowserCookieGetResult,\n  BrowserCookieSetResult\n} from '../../shared/runtime-types'\nimport type { CommandHandler } from '../dispatch'\nimport { printResult } from '../format'\nimport { getOptionalStringFlag, getRequiredStringFlag } from '../flags'\nimport { RuntimeClientError } from '../runtime-client'\nimport { getBrowserCommandTarget } from '../selectors'\n\nfunction getOptionalCookieExpiry(flags: Map<string, string | boolean>): number | undefined {\n  if (!flags.has('expires')) {\n    return undefined\n  }\n  const rawExpires = flags.get('expires')\n  if (typeof rawExpires !== 'string' || rawExpires.length === 0) {\n    throw new RuntimeClientError('invalid_argument', 'Missing value for --expires.')\n  }\n  const expires = Number(rawExpires)\n  if (!Number.isFinite(expires) || expires < 0) {\n    throw new RuntimeClientError('invalid_argument', `Invalid --expires value: ${rawExpires}`)\n  }\n  return expires\n}\n\nexport const BROWSER_COOKIE_HANDLERS: Record<string, CommandHandler> = {\n  'cookie get': async ({ flags, client, cwd, json }) => {\n    const url = getOptionalStringFlag(flags, 'url')\n    const target = await getBrowserCommandTarget(flags, cwd, client)\n    const result = await client.call<BrowserCookieGetResult>('browser.cookie.get', {\n      url,\n      ...target\n    })\n    printResult(result, json, (v) => {\n      if (v.cookies.length === 0) {","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/browser-cookie.ts#L1-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Provide a numeric expiry value: `--expires <ms>` (a non-negative number).","If using shell variable expansion, ensure the variable is set and non-empty, or drop --expires entirely to omit the expiry.","Double-check there is no `=` with nothing after it and that --expires is not the last token."],"exampleFix":"// before\norca cookie set --url https://x --name sid --value v --expires\n// after\norca cookie set --url https://x --name sid --value v --expires 3600000","handlingStrategy":"validation","validationCode":"function readExpiresFlag(flags: Map<string, string | boolean>): string | undefined {\n  if (!flags.has('expires')) return undefined\n  const v = flags.get('expires')\n  if (typeof v !== 'string' || v.length === 0) {\n    throw new Error('--expires requires a numeric value')\n  }\n  return v\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --expires with a numeric token in scripts.","Guard shell-variable expansion: only emit --expires when the variable is non-empty.","Avoid --expires at end of line where the parser may treat it as a boolean."],"tags":["cli","browser","cookie","flag-validation","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}