Mintplex-Labs/anything-llm · error · Error

click requires <x> <y> coordinates

Error message

click requires <x> <y> coordinates

What it means

Thrown by the 'click' branch of cdp-input.js after it parses process.argv[3] and process.argv[4] with parseFloat. If either coordinate is NaN the click cannot be dispatched. This guards against missing or non-numeric positional arguments before any CDP Input.dispatchMouseEvent call is made.

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 526360e320)

Solutions

  1. Supply two numeric coordinates: `node cdp-input.js click 320 240`.
  2. In the calling code, validate coordinates with Number.isFinite before spawning the process.
  3. Check argument indexing — click expects argv[3]=x, argv[4]=y, argv[5]=optional target_url.
  4. Log process.argv at the start of the caller to confirm positions.

Example fix

// before
spawn('node', ['cdp-input.js', 'click', mouseX, optionalUrl]);
// after — x and y must occupy argv[3] and argv[4]
spawn('node', ['cdp-input.js', 'click', String(mouseX), String(mouseY), optionalUrl]);
Defensive patterns

Strategy: validation

Validate before calling

const x = Number(args[0]);
const y = Number(args[1]);
if (!Number.isFinite(x) || !Number.isFinite(y)) {
  throw new Error(`click needs finite x,y coordinates, got ${args[0]}, ${args[1]}`);
}

Prevention

When it happens

Trigger: Invoking `node cdp-input.js click` with fewer than two coordinate args, or with non-numeric values like `node cdp-input.js click abc def`. Also triggered by swapping argument order so the coordinates land in the wrong argv slots.

Common situations: Caller script built the argv array dynamically and inserted an empty string for x/y; coordinates were read from a selector that returned null; argument quoting on the shell swallowed a value.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/17b097093a1120d3. Report an issue: GitHub.