stablyai/orca · error · RuntimeClientError
invalid_argument
invalid_argument
Error message
Window targeting accepts either windowId or windowIndex, not both
What it means
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.
Source
Thrown at src/main/computer/computer-provider-action-validation.ts:66
case 'pasteText':
await validatePasteText(params)
return app
case 'pressKey':
validatePressKey(params)
return app
case 'hotkey':
validateHotkey(params)
return app
case 'setValue':
requireNonNegativeInteger(params, 'elementIndex')
requireStringAllowingEmpty(params, 'value')
return app
}
}
function validateWindowTarget(params: Record<string, unknown>): void {
if (params.windowId !== undefined && params.windowIndex !== undefined) {
throw new RuntimeClientError(
'invalid_argument',
'Window targeting accepts either windowId or windowIndex, not both'
)
}
}
function validateElementOrCoordinates(
actionName: 'Click' | 'Scroll',
params: Record<string, unknown>
): void {
const hasElement = params.elementIndex !== undefined
const hasX = params.x !== undefined
const hasY = params.y !== undefined
if (!hasElement && !(hasX && hasY)) {
throw new RuntimeClientError(
'invalid_argument',
`${actionName} requires elementIndex or both x and y`
)View on GitHub (pinned to 1136503c6a)
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.
Example fix
// before
validateComputerProviderActionParams('click', { app, windowId: 3, windowIndex: 1, elementIndex: 0 })
// throws: Window targeting accepts either windowId or windowIndex, not both
// after
validateComputerProviderActionParams('click', { app, windowId: 3, elementIndex: 0 }) Defensive patterns
Strategy: validation
Validate before calling
function hasExactlyOneWindowTarget(params: Record<string, unknown>): boolean {
const hasId = params.windowId !== undefined
const hasIndex = params.windowIndex !== undefined
return hasId !== hasIndex // exactly one
}
if (!hasExactlyOneWindowTarget(params)) {
// remove one of the fields before calling
} Type guard
type WindowTarget =
| { windowId: number | string; windowIndex?: undefined }
| { windowId?: undefined; windowIndex: number }
| { windowId?: undefined; windowIndex?: undefined }
function isExclusiveWindowTarget(params: Record<string, unknown>): params is WindowTarget {
return !(params.windowId !== undefined && params.windowIndex !== undefined)
} Try / catch
try {
validateComputerProviderActionParams('click', params)
} catch (error) {
if (error instanceof RuntimeClientError && error.code === 'invalid_argument') {
// fix the params: drop the weaker window target and retry
const { windowIndex, ...rest } = params
validateComputerProviderActionParams('click', rest)
} else throw error
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid_argument
- {name} must be a positive number
- {name} is required
- unsupported mouse button: {button}
- click modifiers require modifier keys only
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/198785b9cef72e1c.
Report an issue: GitHub.