{"record":{"id":"d5561be362e21011","repo":"Hmbown/CodeWhale","slug":"x-y-is-covered-by-a-window-owned-by-w-owner-name-another","errorCode":null,"errorMessage":"(${x}, ${y}) is covered by a window owned by ${w.owner_name || \"another application\"} (pid ${w.owner_pid}) — use an accessibility element target or a separate computer; no pointer input was sent","messagePattern":"\\((.+?), (.+?)\\) is covered by a window owned by (.+?) \\(pid (.+?)\\) — use an accessibility element target or a separate computer; no pointer input was sent","errorType":"exception","errorClass":"ExecError","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/src/backends/darwin.mjs","lineNumber":376,"sourceCode":"  function mouseName(button) { return { left: \"left\", right: \"right\", middle: \"middle\" }[button] ?? \"left\"; }\n\n  function assertInScreen(x, y) {\n    if (!Number.isFinite(x) || !Number.isFinite(y)) throw new ExecError(\"coordinates must be finite numbers\");\n  }\n\n  function buttonCode(button) { return button === \"middle\" ? 2 : button === \"right\" ? 1 : 0; }\n\n  function requireSharedPointer() {\n    if (!state.foregroundInput) throw Object.assign(new ExecError(\"This action needs the shared macOS pointer and was not sent in background mode. Use an accessibility action or a separate computer; foreground control requires exclusive desktop use authorized by the user.\"), { code: \"shared_pointer_required\" });\n  }\n\n  /** Refuse a global gesture whose landing point belongs to another application. */\n  async function assertOwnsPoint(x, y) {\n    if (!state.inputApp) throw new ExecError(\"open_application first to choose which application receives input\");\n    const w = await native(\"window_at_point\", { x, y });\n    if (!w?.found) throw new ExecError(`no window at (${x}, ${y}) — take a fresh screenshot and choose a point inside the target window`);\n    if (w.owner_pid !== state.inputApp.pid) {\n      throw new ExecError(`(${x}, ${y}) is covered by a window owned by ${w.owner_name || \"another application\"} (pid ${w.owner_pid}) — use an accessibility element target or a separate computer; no pointer input was sent`);\n    }\n    return w;\n  }\n\n  /** What a global gesture cost the user: their cursor, and briefly their foreground. */\n  function pointerCost(r) {\n    return {\n      pointer_moved: true,\n      pointer_restored: !!r?.restored,\n      foreground_taken: !!r?.foreground_taken,\n      ...(r?.foreground_before ? { foreground_before: r.foreground_before } : {}),\n      ...(r?.foreground_after ? { foreground_after: r.foreground_after } : {}),\n      ...(Number.isFinite(r?.yield_ms) && r.yield_ms > 0 ? { yield_ms: r.yield_ms } : {}),\n    };\n  }\n\n  async function gesture(steps, { restore = true, guard = null } = {}) {\n    requireSharedPointer();","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/backends/darwin.mjs#L358-L394","documentation":"assertOwnsPoint refuses to send a global pointer gesture when the window at the target point belongs to a different process than the application opened via open_application. This guard prevents sending synthetic clicks/gestures into another app's UI, which could misfire on unrelated windows. No pointer input was sent, so the caller's intent was not executed.","triggerScenarios":"Calling a global gesture/click API with coordinates where the topmost window's owner_pid differs from state.inputApp.pid, e.g. after the target window moved, closed, was occluded, or the point was never inside the bound app.","commonSituations":"Stale screenshot coordinates after the user switched apps; the target window is covered by a dialog/overlay from another process; the caller forgot to call open_application first and is clicking on the desktop or another app.","solutions":["Take a fresh screenshot and re-target coordinates to a point visibly inside the bound application's window","Call open_application for the owning app (or re-bind state.inputApp) before sending pointer input","Switch to an accessibility element target (hit_test / a11y strategy) that needs no pointer","Use a separate computer-use session scoped to the app that actually owns the point"],"exampleFix":"// before\nawait click(500, 400); // point may be covered by another app\n// after\nconst shot = await screenshot(); // fresh observation\nawait click(shot.targetX, shot.targetY); // verified inside bound app","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await click(x, y);\n} catch (e) {\n  if (e instanceof ExecError && /covered by a window owned by/.test(e.message)) {\n    const shot = await screenshot();\n    // re-target coordinates from the fresh screenshot or rebind via open_application\n  } else throw e;\n}","preventionTips":["Always call open_application before pointer input","Re-screenshot immediately before each gesture instead of reusing stale coordinates","Prefer accessibility element targets, which never need the pointer","Keep a separate computer session per application"],"tags":["macos","pointer-input","window-ownership","guard"],"backgroundTag":"permission-denied","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}