{"record":{"id":"9d89798f16fb50c8","repo":"stablyai/orca","slug":"invalid-argument-9d8979","errorCode":"invalid_argument","errorMessage":"Window targeting accepts either --window-id or --window-index, not both","messagePattern":"Window targeting accepts either --window-id or --window-index, not both","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/computer-action-flag-validation.ts","lineNumber":8,"sourceCode":"import { RuntimeClientError } from '../runtime-client'\n\nexport function validateExclusiveWindowTarget(\n  windowId: number | undefined,\n  windowIndex: number | undefined\n): void {\n  if (windowId !== undefined && windowIndex !== undefined) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      'Window targeting accepts either --window-id or --window-index, not both'\n    )\n  }\n}\n\nexport function validateElementOrCoordinates(\n  actionName: 'Click' | 'Scroll',\n  elementIndex: number | undefined,\n  x: number | undefined,\n  y: number | undefined\n): void {\n  const hasElement = elementIndex !== undefined\n  const hasX = x !== undefined\n  const hasY = y !== undefined\n  if (!hasElement && !(hasX && hasY)) {\n    throw new RuntimeClientError(\n      'invalid_argument',","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/computer-action-flag-validation.ts#L1-L26","documentation":"Thrown by validateExclusiveWindowTarget when both --window-id and --window-index are supplied to a computer-action command. These are two ways to identify the same OS window (opaque id vs positional index); passing both is ambiguous, so the validator rejects the combination before the action is dispatched.","triggerScenarios":"Any computer-action call (click, scroll, screenshot, etc.) routed through validateExclusiveWindowTarget with both `windowId !== undefined` and `windowIndex !== undefined`, e.g. `--window-id 42 --window-index 0`.","commonSituations":"Layered wrapper code that sets --window-id from one source and --window-index from another and never reconciles them. Copy-pasting flags from two examples.","solutions":["Keep exactly one window-targeting flag: --window-id (stable id) OR --window-index (positional).","If you only know the window's position, drop --window-id; if you have its id, drop --window-index.","Make wrapper code resolve a single window reference and emit only the corresponding flag."],"exampleFix":"// before\norca computer click --window-id 42 --window-index 0 --element-index 3\n// after\norca computer click --window-id 42 --element-index 3","handlingStrategy":"validation","validationCode":"function assertSingleWindowTarget(windowId: number | undefined, windowIndex: number | undefined): void {\n  if (windowId !== undefined && windowIndex !== undefined) {\n    throw new Error('pass --window-id OR --window-index, not both')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve a single window reference in wrapper code and emit only one flag.","Prefer the stable --window-id over positional --window-index when available.","Add a unit test covering the mutual-exclusion branch."],"tags":["cli","computer-action","flag-validation","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}