stablyai/orca · error · RuntimeClientError
invalid_argument
invalid_argument
Error message
Clipboard text is too large to copy safely.
What it means
Thrown by validateComputerClipboardPasteText (the synchronous path) when the paste text exceeds the clipboard write byte limit (CLIPBOARD_TEXT_WRITE_MAX_BYTES = 16 MiB UTF-8). It is surfaced as a RuntimeClientError with code 'invalid_argument' and the shared CLIPBOARD_TEXT_WRITE_TOO_LARGE_ERROR message, so it maps cleanly to a provider-facing invalid-argument rejection.
Source
Thrown at src/main/computer/computer-clipboard-paste-validation.ts:15
import {
CLIPBOARD_TEXT_MEASURE_YIELD_CODE_UNITS,
CLIPBOARD_TEXT_WRITE_TOO_LARGE_ERROR,
assertClipboardTextWriteWithinLimit,
assertClipboardTextWriteWithinLimitWithYield,
isClipboardTextWriteTooLargeError
} from '../../shared/clipboard-text'
import { RuntimeClientError } from './runtime-client-error'
export function validateComputerClipboardPasteText(text: string): void {
try {
assertClipboardTextWriteWithinLimit(text)
} catch (error) {
if (isClipboardTextWriteTooLargeError(error)) {
throw new RuntimeClientError('invalid_argument', CLIPBOARD_TEXT_WRITE_TOO_LARGE_ERROR)
}
throw error
}
}
export async function validateComputerClipboardPasteTextWithYield(text: string): Promise<void> {
try {
// Why: accepted paste-sized payloads must not monopolize the main process
// while preserving the provider-facing invalid_argument error contract.
await assertClipboardTextWriteWithinLimitWithYield(text)
} catch (error) {
if (isClipboardTextWriteTooLargeError(error)) {
throw new RuntimeClientError('invalid_argument', CLIPBOARD_TEXT_WRITE_TOO_LARGE_ERROR)
}
throw error
}
}
View on GitHub (pinned to 1136503c6a)
Solutions
- Truncate or chunk the text before calling paste so its UTF-8 size stays under 16 MiB.
- Stream the large content to the target via a file or IPC channel instead of the clipboard.
- Reject oversized payloads at the action-validation layer with a clear user-facing message before they reach the clipboard path.
Example fix
// before: pasting a multi-MiB blob
validateComputerClipboardPasteText(hugeBlob) // throws invalid_argument
// after: bound the size before pasting
import { CLIPBOARD_TEXT_WRITE_MAX_BYTES, measureClipboardTextByteLength } from '../../shared/clipboard-text'
const safe = measureClipboardTextByteLength(hugeBlob).byteLength <= CLIPBOARD_TEXT_WRITE_MAX_BYTES
? hugeBlob : hugeBlob.slice(0, CLIPBOARD_TEXT_WRITE_MAX_BYTES)
validateComputerClipboardPasteText(safe) Defensive patterns
Strategy: validation
Validate before calling
import {
CLIPBOARD_TEXT_WRITE_MAX_BYTES,
measureClipboardTextByteLength
} from '../../shared/clipboard-text'
function isWithinClipboardWriteLimit(text: string): boolean {
return measureClipboardTextByteLength(text).byteLength <= CLIPBOARD_TEXT_WRITE_MAX_BYTES
}
if (!isWithinClipboardWriteLimit(text)) {
// truncate or chunk before pasting
} Type guard
import { RuntimeClientError } from './runtime-client-error'
function isClipboardTooLargeError(error: unknown): boolean {
return (
error instanceof RuntimeClientError &&
error.code === 'invalid_argument' &&
error.message === 'Clipboard text is too large to copy safely.'
)
} Try / catch
try {
validateComputerClipboardPasteText(text)
} catch (error) {
if (error instanceof RuntimeClientError && error.code === 'invalid_argument') {
// size guard: chunk the paste or reject with a user-facing message
text = text.slice(0, CLIPBOARD_TEXT_WRITE_MAX_BYTES)
validateComputerClipboardPasteText(text)
} else {
throw error
}
} Prevention
- Measure UTF-8 byte length before large paste operations.
- Prefer streaming large content via file/IPC over the clipboard.
- Reject oversized payloads in the UI/agent layer with a clear message.
When it happens
Trigger: validateComputerClipboardPasteText(text) where measureClipboardTextByteLength exceeds CLIPBOARD_TEXT_WRITE_MAX_BYTES (16 MiB). Reached directly for small payloads or via validateComputerClipboardPasteTextWithBoundedYield when text.length <= CLIPBOARD_TEXT_MEASURE_YIELD_CODE_UNITS (256K code units).
Common situations: An agent action tries to paste a huge file body, a base64 blob, or an oversized log dump; an LLM-generated pasteText param exceeds the limit; a test fixture uses an oversized string.
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/527e756103889ce9.
Report an issue: GitHub.