stablyai/orca · error · Error
Browser rich-text editing command failed
Error message
Browser rich-text editing command failed
What it means
Thrown by the injected rich-text edit expression when document.execCommand('insertText'|'delete', ...) returns false or throws. execCommand is the bridge's chosen edit path because it produces a real input transaction that rich editors reconcile; when it fails, the value was not committed to the editor's model, so the bridge refuses to report success.
Source
Thrown at src/main/browser/agent-browser-bridge.ts:146
' 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)
}
type AgentBrowserExecOptions = {
envOverrides?: NodeJS.ProcessEnv
timeoutMs?: number
timeoutError?: BrowserError
stdinText?: string
}
type EnqueueTargetedCommandOptions = {View on GitHub (pinned to 1136503c6a)
Solutions
- Confirm the editor is editable and focused before filling.
- For editors known to block execCommand, dispatch input events directly (BeforeInputEvent) via CDP instead.
- Retry focus then fill, since focus loss is a common cause of execCommand returning false.
- If the editor exposes a programmatic setValue API, use that instead of simulated typing.
Example fix
// before
await bridge.fill(editorSelector, text)
// after
await bridge.focus(editorSelector)
try {
await bridge.fill(editorSelector, text)
} catch (err) {
if (/rich-text editing command failed/i.test(err.message)) {
// editor blocks execCommand — use CDP input-event dispatch
await dispatchInputEventViaCdp(editorSelector, text)
} else throw err
} Defensive patterns
Strategy: fallback
Validate before calling
// confirm the editor accepts execCommand before relying on fill:\nconst editable = await isFocusedEditable(bridge)\nif (!editable) {\n await bridge.focus(selector)\n} Type guard
async function editorAcceptsExecCommand(bridge: BrowserBridge): Promise<boolean> {\n return (await bridge.eval('(() => { try { return document.execCommand(\"insertText\", false, \"\") === true; } catch { return false; } })()')) === true\n} Try / catch
try {\n await bridge.fill(selector, text)\n} catch (err) {\n if (/Browser rich-text editing command failed/.test((err as Error).message)) {\n await dispatchInputEventViaCdp(selector, text) // editor blocks execCommand\n return\n }\n throw err\n} Prevention
- Confirm the editor is editable and focused before filling.
- For editors that block execCommand (Lexical, Slate), dispatch input events via CDP.
- Retry focus then fill once.
- Use the editor's own setValue API when available.
When it happens
Trigger: The contentEditable element does not support execCommand text insertion (some custom editors intercept/preventDefault on beforeinput), the editor is read-only/disabled, execCommand is deprecated and unimplemented for a given editor type, or the editable region lost focus mid-edit.
Common situations: Filling a rich editor that overrides default input handling (Lexical, Slate, custom ContentEditable), an editor in a disabled/readonly state, or a browser build where execCommand is a no-op for the focused node.
Related errors
- Focused rich-text target is unavailable
- Rich-text selection is unavailable
- 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/530565a8e4f2948f.
Report an issue: GitHub.