{"record":{"id":"17b097093a1120d3","repo":"Mintplex-Labs/anything-llm","slug":"click-requires-x-y-coordinates","errorCode":null,"errorMessage":"click requires <x> <y> coordinates","messagePattern":"click requires <x> <y> coordinates","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-computer/services/interface-service/utils/cdp-input.js","lineNumber":124,"sourceCode":"      const match = pages.find(\n        (p) => p.url.includes(targetUrl) || p.title.toLowerCase().includes(targetUrl.toLowerCase())\n      );\n      if (!match) {\n        const openTabs = pages.map((p) => `- ${p.title} ${p.url}`).join(\"\\n\");\n        throw new Error(`No browser tab matching \"${targetUrl}\". Open tabs:\\n${openTabs}`);\n      }\n      if (match) target = match;\n    }\n\n    const { sessionId } = await cdpSend(ws, \"Target.attachToTarget\", {\n      targetId: target.targetId,\n      flatten: true,\n    });\n\n    if (action === \"click\") {\n      const x = parseFloat(process.argv[3]);\n      const y = parseFloat(process.argv[4]);\n      if (isNaN(x) || isNaN(y)) throw new Error(\"click requires <x> <y> coordinates\");\n\n      // Move mouse to position first (triggers hover states)\n      await cdpSend(ws, \"Input.dispatchMouseEvent\", {\n        type: \"mouseMoved\", x, y\n      }, sessionId);\n      await sleep(50);\n\n      // Press\n      await cdpSend(ws, \"Input.dispatchMouseEvent\", {\n        type: \"mousePressed\", x, y, button: \"left\", clickCount: 1\n      }, sessionId);\n      await sleep(30 + Math.floor(Math.random() * 40));\n\n      // Release\n      await cdpSend(ws, \"Input.dispatchMouseEvent\", {\n        type: \"mouseReleased\", x, y, button: \"left\", clickCount: 1\n      }, sessionId);\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/open-computer/services/interface-service/utils/cdp-input.js#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Supply two numeric coordinates: `node cdp-input.js click 320 240`.","In the calling code, validate coordinates with Number.isFinite before spawning the process.","Check argument indexing — click expects argv[3]=x, argv[4]=y, argv[5]=optional target_url.","Log process.argv at the start of the caller to confirm positions."],"exampleFix":"// before\nspawn('node', ['cdp-input.js', 'click', mouseX, optionalUrl]);\n// after — x and y must occupy argv[3] and argv[4]\nspawn('node', ['cdp-input.js', 'click', String(mouseX), String(mouseY), optionalUrl]);","handlingStrategy":"validation","validationCode":"const x = Number(args[0]);\nconst y = Number(args[1]);\nif (!Number.isFinite(x) || !Number.isFinite(y)) {\n  throw new Error(`click needs finite x,y coordinates, got ${args[0]}, ${args[1]}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate coordinates with Number.isFinite before spawning cdp-input.js.","Keep argument order documented: click <x> <y> [target_url].","Unit-test the argv builder in the caller."],"tags":["cdp","browser-automation","argument-validation","click"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}