stablyai/orca · warning · Error
Rich-text selection is unavailable
Error message
Rich-text selection is unavailable
What it means
Thrown by the injected rich-text edit expression when selectAll is requested but typeof window.getSelection !== 'function'. This is an environment capability check: the selection API is unavailable, so a select-all-then-insert operation cannot proceed. Extremely rare in modern Chromium/Electron guests but possible in heavily restricted or non-standard embeds.
Source
Thrown at src/main/browser/agent-browser-bridge.ts:136
}
// Why: rich editors reconcile only real browser edit transactions; a direct-DOM fallback can leave their model stale.
function focusedRichTextEditExpression(
valueExpression: string,
options?: { selectAll?: boolean }
): string {
const selectAll = options?.selectAll ? 'true' : 'false'
return [
'(() => {',
' const target = document.activeElement;',
' const value = ',
valueExpression,
';',
` const selectAll = ${selectAll};`,
" const isEditable = target?.isContentEditable === true || /^(|true|plaintext-only)$/i.test(target?.getAttribute?.('contenteditable') ?? 'false');",
" if (!target || target === document.body || !isEditable) { throw new Error('Focused rich-text target is unavailable'); }",
' if (selectAll) {',
" if (typeof window.getSelection !== 'function') { throw new Error('Rich-text selection is unavailable'); }",
' const selection = window.getSelection();',
" if (!selection) { throw new Error('Rich-text selection is unavailable'); }",
' selection.selectAllChildren(target);',
' }',
" const editCommand = selectAll && value.length === 0 ? 'delete' : 'insertText';",
' let edited = false;',
' try {',
' edited = document.execCommand(editCommand, false, value) === true;',
' } catch { edited = false; }',
" if (!edited) { throw new Error('Browser rich-text editing command failed'); }",
' })()'
].join('')
}
function isExplicitContentEditableResult(result: unknown): boolean {
const value =
result && typeof result === 'object' ? (result as { value?: unknown }).value : undefined
return typeof value === 'string' && /^(|true|plaintext-only)$/i.test(value)View on GitHub (pinned to 1136503c6a)
Solutions
- Detect window.getSelection availability before requesting selectAll, and fall back to inserting without selecting all.
- Avoid selectAll for editors that expose their own select-all API.
- If the environment is known to lack the Selection API, insert at the cursor instead of replacing all content.
- Report the environment limitation to the user rather than retrying.
Example fix
// before
await bridge.fill(editorSelector, text, { selectAll: true })
// after
const canSelectAll = await bridge.eval('typeof window.getSelection === "function"')
await bridge.fill(editorSelector, text, { selectAll: canSelectAll === true }) Defensive patterns
Strategy: type-guard
Validate before calling
const selectAllSupported = await bridge.eval('typeof window.getSelection === \"function\"')\nawait bridge.fill(selector, text, { selectAll: selectAllSupported === true }) Type guard
async function selectionApiAvailable(bridge: BrowserBridge): Promise<boolean> {\n return (await bridge.eval('typeof window.getSelection === \"function\"')) === true\n} Prevention
- Detect window.getSelection availability before requesting selectAll.
- Fall back to cursor-position insertion when the Selection API is absent.
- Do not assume modern APIs in heavily restricted guests.
- Report environment limitations rather than retrying.
When it happens
Trigger: Calling a rich-text fill with selectAll:true inside a browser context where window.getSelection has been deleted, shadowed, or is otherwise not a function (e.g. a stripped-down or sandboxed guest that removes the Selection API).
Common situations: A page or embedding that deletes/overrides window.getSelection, an unusual webview configuration, or an extension that clobbers the selection API.
Related errors
- Focused rich-text target is unavailable
- Browser rich-text editing command failed
- browser_tab_not_found
- [plain-node-entry-guard] "${entryName}" reaches chunk "${chu
- Electron did not expose GC; keep --js-flags=--expose-gc in t
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/ca7be5fab1f98bd3.
Report an issue: GitHub.