Mintplex-Labs/anything-llm · error
click requires coordinates
Error message
click requires <x> <y> coordinates
What it means
cdp-input argument validation: for action 'click', parseFloat of argv[3] and argv[4] must both be finite numbers; if either is NaN the helper refuses to dispatch Input.dispatchMouseEvent. Coordinates are CSS pixels in the page's viewport, matching what Runtime.evaluate-based positioning would produce.
Solutions
- Pass two finite numbers: node cdp-input.js click <x> <y> [tabFilter]
- Validate/guard in the calling code that x and y are numbers before spawning the helper
- If coordinates come from a prior screenshot/eval step, make sure they are pixels (numbers), not percentage strings or empty values
Example fix
// before
spawn('node', ['cdp-input.js', 'click', String(x), String(y ?? '')])
// after
if (!Number.isFinite(x) || !Number.isFinite(y)) throw new Error('need numeric x,y');
spawn('node', ['cdp-input.js', 'click', String(x), String(y)]) Defensive patterns
Strategy: validation
Validate before calling
function validClickArgs(x, y) {
const nx = Number(x), ny = Number(y);
return Number.isFinite(nx) && Number.isFinite(ny);
}
if (!validClickArgs(process.argv[3], process.argv[4])) { console.error('usage: cdp-input.js click <x> <y> [tabFilter]'); process.exit(2); } Type guard
function isFiniteCoords(x: unknown, y: unknown): x is number & number extends never ? never : number {
return Number.isFinite(Number(x)) && Number.isFinite(Number(y));
} Try / catch
try { await sendInput('click', x, y); } catch (e) { if (/click requires <x> <y> coordinates/.test(e.message)) { /* fix argument production upstream — do not retry unchanged */ } else throw e; } Prevention
- Check Number.isFinite on both coordinates before spawning the helper — it only validates after connecting
- Log the exact argv array in wrappers when input commands fail, positional bugs are the usual cause
- Source coordinates from the same viewport context that rendered them (CSS px vs device px with DPR)
When it happens
Trigger: Calling `node cdp-input.js click` with missing x/y, non-numeric x/y ('click abc def'), or swapped argument order where a filter string lands in argv[3]/argv[4]; passing empty strings.
Common situations: Automated callers building the command from variables that are undefined/empty; forgetting that click takes two coordinate args before the optional tab filter; copy-paste from a type invocation keeping the old arg layout.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- key requires argument (e.g. Enter, Tab, Escape)
- type requires argument
- No browser tab matching
- No browser pages open.
- No browser pages open.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/17b097093a1120d3.
Report an issue: GitHub.
Appendix: source
Thrown at open-computer/services/interface-service/utils/cdp-input.js:124
const match = pages.find(
(p) => p.url.includes(targetUrl) || p.title.toLowerCase().includes(targetUrl.toLowerCase())
);
if (!match) {
const openTabs = pages.map((p) => `- ${p.title} ${p.url}`).join("\n");
throw new Error(`No browser tab matching "${targetUrl}". Open tabs:\n${openTabs}`);
}
if (match) target = match;
}
const { sessionId } = await cdpSend(ws, "Target.attachToTarget", {
targetId: target.targetId,
flatten: true,
});
if (action === "click") {
const x = parseFloat(process.argv[3]);
const y = parseFloat(process.argv[4]);
if (isNaN(x) || isNaN(y)) throw new Error("click requires <x> <y> coordinates");
// Move mouse to position first (triggers hover states)
await cdpSend(ws, "Input.dispatchMouseEvent", {
type: "mouseMoved", x, y
}, sessionId);
await sleep(50);
// Press
await cdpSend(ws, "Input.dispatchMouseEvent", {
type: "mousePressed", x, y, button: "left", clickCount: 1
}, sessionId);
await sleep(30 + Math.floor(Math.random() * 40));
// Release
await cdpSend(ws, "Input.dispatchMouseEvent", {
type: "mouseReleased", x, y, button: "left", clickCount: 1
}, sessionId);
View on GitHub (pinned to 3aec848f28)