Hmbown/CodeWhale · error · RuntimeError
value_rejected
Error message
value_rejected
What it means
After confirming the target is enabled and editable, set_value calls editor.setTextContents(extra) via AT-SPI. A false return means the accessibility layer refused the write; the script raises RuntimeError("value_rejected") rather than proceeding without knowing whether the value landed.
Solutions
- Check the value conforms to the field's constraints (length, mask, charset) and retry
- Clear the field first, then set the value in a smaller chunk
- Use keyboard input strategies instead of direct text-set for masked fields
- Re-resolve the target in case the widget was recreated mid-call
Example fix
// before
await backend.set_value({ target: "#date", value: "not-a-date" }) // value_rejected
// after
await backend.set_value({ target: "#date", value: "2026-09-21" }); Defensive patterns
Strategy: retry
Validate before calling
// pre-check content constraints when known
if (maxLength && value.length > maxLength) throw new Error(`value exceeds field max length ${maxLength}`); Try / catch
try { return await backend.set_value({ target, value }); } catch (e) { if (String(e).includes("value_rejected")) { await clearField(target); return backend.set_value({ target, value }); } throw e; } Prevention
- Conform values to field masks and length limits before writing
- Clear the field before setting when it may already hold content
- Fall back to keyboard input for fields with app-level insertion hooks
When it happens
Trigger: setTextContents returning false — the toolkit accepted the call but rejected the content or the operation at the widget level, e.g. an input mask, length limit, or IME/permission constraint on the control.
Common situations: Writing a value longer than the field's max length; writing text that a masked input (date/phone) rejects; the application's own validation hooking text insertion and refusing it.
Related errors
- element_disabled
- element_read_only
- invalid_value
- value_verification_failed
- application not found or name is ambiguous in the AT-SPI…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/f09a283abe8e8a2e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/plugins/computer-use/src/backends/linux.mjs:705
} finally { await releaseKey(k); }
} else await waylandKey(text, { holdMs: Math.round(d * 1000) });
return { action_sent: true, key: k, heldSec: d };
},
set_value: async ({ target, value }) => {
// Select a supported interface before sending input. A refused write or
// failed readback must never trigger a second, ambiguously applied edit.
const out = await atspiResolve(target, ` state = found.getState()
if not state.contains(pyatspi.STATE_ENABLED):
raise RuntimeError("element_disabled")
try:
editor = found.queryEditableText()
except NotImplementedError:
editor = None
if editor is not None:
if not state.contains(pyatspi.STATE_EDITABLE):
raise RuntimeError("element_read_only")
if not editor.setTextContents(extra):
raise RuntimeError("value_rejected")
text = found.queryText()
after = text.getText(0, text.characterCount)
if after != extra:
raise RuntimeError("value_verification_failed")
else:
import math
desired = float(extra)
if not math.isfinite(desired):
raise RuntimeError("invalid_value")
numeric = found.queryValue()
numeric.currentValue = desired
after = numeric.currentValue
if after != desired:
raise RuntimeError("value_verification_failed")
print(json.dumps({"ok": True, "after": after}))`, String(value));
if (!out.ok) throw new ExecError(`set_value failed: ${out.code}`);
return { action_sent: true, strategy: "a11y", verified: true, after: out.after };
},View on GitHub (pinned to 73e0f67d83)