{"record":{"id":"891bf7145859a2bc","repo":"Hmbown/CodeWhale","slug":"could-not-parse-xdotool-getmouselocation-output-out","errorCode":null,"errorMessage":"could not parse xdotool getmouselocation output: ${out}","messagePattern":"could not parse xdotool getmouselocation output: (.+?)","errorType":"exception","errorClass":"ExecError","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/src/backends/linux.mjs","lineNumber":765,"sourceCode":"      const r = await run(cmd[0], cmd.slice(1), { timeoutMs: 10_000 });\n      if (r.code !== 0) throw new ExecError(\"clipboard read failed\", r);\n      return { text: r.stdout, encoding: \"utf8\" };\n    },\n    write_clipboard: async ({ text }) => {\n      await probeSession();\n      const cmd = session === \"x11\"\n        ? (tools.xclip ? [\"xclip\", \"-selection\", \"clipboard\"] : [\"xsel\", \"--clipboard\", \"--input\"])\n        : [\"wl-copy\"];\n      need(cmd[0], \"clipboard write\");\n      spawnDetached(cmd[0], cmd.slice(1), String(text ?? \"\"), true);\n      return { written: String(text ?? \"\").length };\n    },\n    cursor_position: async () => {\n      await probeSession();\n      if (session === \"x11\") {\n        const out = await xdotool([\"getmouselocation\"]);\n        const m = /x:(-?\\d+)\\s+y:(-?\\d+)/.exec(out);\n        if (!m) throw new ExecError(`could not parse xdotool getmouselocation output: ${out}`);\n        return { x: Number(m[1]), y: Number(m[2]) };\n      }\n      throw new ExecError(\"cursor position needs an X11 session in this build\");\n    },\n    recordingStart: async () => {\n      throw Object.assign(new ExecError(\"Recording is unavailable on this platform until the recorder has session-owned cleanup. Use screenshots instead.\"), { code: \"owned_recording_unavailable\" });\n    },\n    recordingStop: async ({ id }) => { throw new ExecError(`unknown recording \"${id}\"`); },\n    recordingStatus: ({ id }) => ({ id, running: false }),\n    recordingList: async () => {\n      const dir = recordingsDir();\n      const out = fs.existsSync(dir)\n        ? fs.readdirSync(dir).filter((f) => /\\.(mp4|mkv|png)$/i.test(f)).map((f) => {\n            const st = fs.statSync(path.join(dir, f));\n            return { file: path.join(dir, f), bytes: st.size, modifiedAt: st.mtime.toISOString() };\n          }).sort((a, b) => b.modifiedAt.localeCompare(a.modifiedAt)).slice(0, 50)\n        : [];\n      return { dir, recordings: out, running: [] };","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/backends/linux.mjs#L747-L783","documentation":"The cursor_position handler for X11 runs `xdotool getmouselocation` and parses coordinates with the regex /x:(-?\\d+)\\s+y:(-?\\d+)/. If the tool's output doesn't match (regex exec returns null), the backend throws this ExecError including the raw output. It protects callers from silently returning NaN/garbage coordinates.","triggerScenarios":"Calling cursor_position on an X11 session where xdotool prints an error line (e.g. 'No such file or directory', 'failed to select inputs') or a localized/unexpected format instead of `x:123 y:456 ...`.","commonSituations":"xdotool present but cannot open the display (DISPLAY pointing at wrong screen); very old or patched xdotool versions with different output ordering; xdotool shimmed by a script that emits warnings first; running under XWayland where getmouselocation fails.","solutions":["Run `xdotool getmouselocation` manually and check its output/exit code","Verify DISPLAY resolves to an accessible X server (e.g. `echo $DISPLAY; xset q`)","Upgrade or reinstall xdotool to a standard version","Inspect the raw output embedded in the error message to see what actually came back"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const probe = await run('xdotool', ['getmouselocation'], { timeoutMs: 5000 });\nif (probe.code !== 0 || !/x:-?\\d+\\s+y:-?\\d+/.test(probe.stdout)) throw new SkipError('xdotool output unusable');","typeGuard":null,"tryCatchPattern":"try { pos = await cursorPosition(); } catch (e) { pos = null; log.warn('cursor position unavailable:', e.message); }","preventionTips":["Smoke-test xdotool at session start, not per-call","Log the raw output included in the message before debugging format assumptions","Pin a known-good xdotool version in your environment"],"tags":["xdotool","parse-error","linux","x11","mouse"],"backgroundTag":"unexpected-response-shape","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}