different-ai/openwork · error · Error

Computer action failed: ${action.type}

Error message

Computer action failed: ${action.type}

What it means

After executing a computer action via executeCuaAction, the loop parses the tool's text payload. If the payload reports ok:false and there's no specific actionPayload.error message and no snapshot-required continuation, it throws this fallback naming the failed action type (e.g. click, type, scroll).

Source

Thrown at packages/handsfree/src/cua-runner.mjs:66

        if (text) {
          messages.push(text);
          onProgress?.({ kind: "message", text });
        }
      }
      if (item.type === "computer_call") computerCall = item;
    }

    if (!computerCall) return { ok: true, messages, turns: turn + 1 };

    for (const action of computerCall.actions || (computerCall.action ? [computerCall.action] : [])) {
      if (signal?.aborted) return { ok: true, messages, turns: turn + 1, aborted: true };
      if (action.type === "screenshot") continue;
      onProgress?.({ kind: "action", ...summarizeAction(action) });
      const actionResult = await executeCuaAction(callTool, action);
      const actionPayload = parseToolText(actionResult);
      if (actionPayload?.ok === false) {
        if (actionPayload.requiredNextAction === "snapshot") break;
        throw new Error(actionPayload.error || `Computer action failed: ${action.type}`);
      }
      await delay(150);
    }

    const screenshot = await callTool("cua_screenshot", {});
    const image = extractImage(screenshot);
    if (!image) throw new Error("Could not capture screenshot after action.");

    items.push({
      type: "computer_call_output",
      call_id: computerCall.call_id,
      acknowledged_safety_checks: computerCall.pending_safety_checks || [],
      output: { type: "input_image", image_url: `data:image/png;base64,${image}` },
    });
  }

  return { ok: true, messages, turns: maxTurns, truncated: true };
}

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Inspect onProgress events just before the throw — the summarizeAction output shows which action failed and its target coordinates.
  2. Re-run with a fresh screenshot first: stale coordinates from an old screenshot are the most common cause of failed clicks.
  3. Check the callTool bridge (CDP connection, browser session) is still alive; re-establish if disconnected.
  4. If the tool returns error details in another field, map it into `error` in executeCuaAction so the real message is thrown instead of the fallback.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await runCuaLoop(opts);
} catch (e) {
  if (e.message.startsWith("Computer action failed:")) {
    await callTool("cua_screenshot", {}); // refresh state, then retry turn
  } else throw e;
}

Prevention

When it happens

Trigger: callTool("...", action) executed but the tool returned an error payload with ok:false and empty error field, or the underlying automation (click target, keystroke injection) failed inside the tool bridge without an error string.

Common situations: Clicking a coordinate that no longer exists after DOM change; keyboard/scroll actions unsupported by the remote browser tool; CDP disconnection mid-action; the action tool returning {ok:false} with details in a field other than `error`.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/21e4d090ad32b4e4. Report an issue: GitHub.