{"record":{"id":"198785b9cef72e1c","repo":"stablyai/orca","slug":"invalid-argument-198785","errorCode":"invalid_argument","errorMessage":"Window targeting accepts either windowId or windowIndex, not both","messagePattern":"Window targeting accepts either windowId or windowIndex, not both","errorType":"validation","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/main/computer/computer-provider-action-validation.ts","lineNumber":66,"sourceCode":"    case 'pasteText':\n      await validatePasteText(params)\n      return app\n    case 'pressKey':\n      validatePressKey(params)\n      return app\n    case 'hotkey':\n      validateHotkey(params)\n      return app\n    case 'setValue':\n      requireNonNegativeInteger(params, 'elementIndex')\n      requireStringAllowingEmpty(params, 'value')\n      return app\n  }\n}\n\nfunction validateWindowTarget(params: Record<string, unknown>): void {\n  if (params.windowId !== undefined && params.windowIndex !== undefined) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      'Window targeting accepts either windowId or windowIndex, not both'\n    )\n  }\n}\n\nfunction validateElementOrCoordinates(\n  actionName: 'Click' | 'Scroll',\n  params: Record<string, unknown>\n): void {\n  const hasElement = params.elementIndex !== undefined\n  const hasX = params.x !== undefined\n  const hasY = params.y !== undefined\n  if (!hasElement && !(hasX && hasY)) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      `${actionName} requires elementIndex or both x and y`\n    )","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/computer/computer-provider-action-validation.ts#L48-L84","documentation":"Thrown by validateWindowTarget during every computer-provider action validation when both windowId and windowIndex are supplied in params. Window targeting is exclusive: the caller must pick exactly one of the two, so providing both is an invalid_argument.","triggerScenarios":"validateComputerProviderActionParams(anyMethod, params) where params.windowId !== undefined && params.windowIndex !== undefined. Runs before the per-method switch, so it applies to click, scroll, drag, typeText, pasteText, pressKey, hotkey, setValue, and performSecondaryAction alike.","commonSituations":"An agent or caller fills in both fields 'to be safe'; a UI form defaults both; serialized state from an older schema carries both keys.","solutions":["Supply only one of windowId or windowIndex; delete the other before calling.","If you have both, resolve to a single target (prefer windowId) and drop windowIndex.","Normalize params upstream so window-targeting is a single discriminated field."],"exampleFix":"// before\nvalidateComputerProviderActionParams('click', { app, windowId: 3, windowIndex: 1, elementIndex: 0 })\n// throws: Window targeting accepts either windowId or windowIndex, not both\n\n// after\nvalidateComputerProviderActionParams('click', { app, windowId: 3, elementIndex: 0 })","handlingStrategy":"validation","validationCode":"function hasExactlyOneWindowTarget(params: Record<string, unknown>): boolean {\n  const hasId = params.windowId !== undefined\n  const hasIndex = params.windowIndex !== undefined\n  return hasId !== hasIndex // exactly one\n}\n\nif (!hasExactlyOneWindowTarget(params)) {\n  // remove one of the fields before calling\n}","typeGuard":"type WindowTarget =\n  | { windowId: number | string; windowIndex?: undefined }\n  | { windowId?: undefined; windowIndex: number }\n  | { windowId?: undefined; windowIndex?: undefined }\n\nfunction isExclusiveWindowTarget(params: Record<string, unknown>): params is WindowTarget {\n  return !(params.windowId !== undefined && params.windowIndex !== undefined)\n}","tryCatchPattern":"try {\n  validateComputerProviderActionParams('click', params)\n} catch (error) {\n  if (error instanceof RuntimeClientError && error.code === 'invalid_argument') {\n    // fix the params: drop the weaker window target and retry\n    const { windowIndex, ...rest } = params\n    validateComputerProviderActionParams('click', rest)\n  } else throw error\n}","preventionTips":["Model window targeting as a discriminated field so both cannot coexist.","Default UI/serialization to a single window-target key.","Validate params with a schema (zod, etc.) before dispatch."],"tags":["computer-use","validation","invalid-argument","window-targeting"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}