{"record":{"id":"21e4d090ad32b4e4","repo":"different-ai/openwork","slug":"computer-action-failed-action-type","errorCode":null,"errorMessage":"Computer action failed: ${action.type}","messagePattern":"Computer action failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/handsfree/src/cua-runner.mjs","lineNumber":66,"sourceCode":"        if (text) {\n          messages.push(text);\n          onProgress?.({ kind: \"message\", text });\n        }\n      }\n      if (item.type === \"computer_call\") computerCall = item;\n    }\n\n    if (!computerCall) return { ok: true, messages, turns: turn + 1 };\n\n    for (const action of computerCall.actions || (computerCall.action ? [computerCall.action] : [])) {\n      if (signal?.aborted) return { ok: true, messages, turns: turn + 1, aborted: true };\n      if (action.type === \"screenshot\") continue;\n      onProgress?.({ kind: \"action\", ...summarizeAction(action) });\n      const actionResult = await executeCuaAction(callTool, action);\n      const actionPayload = parseToolText(actionResult);\n      if (actionPayload?.ok === false) {\n        if (actionPayload.requiredNextAction === \"snapshot\") break;\n        throw new Error(actionPayload.error || `Computer action failed: ${action.type}`);\n      }\n      await delay(150);\n    }\n\n    const screenshot = await callTool(\"cua_screenshot\", {});\n    const image = extractImage(screenshot);\n    if (!image) throw new Error(\"Could not capture screenshot after action.\");\n\n    items.push({\n      type: \"computer_call_output\",\n      call_id: computerCall.call_id,\n      acknowledged_safety_checks: computerCall.pending_safety_checks || [],\n      output: { type: \"input_image\", image_url: `data:image/png;base64,${image}` },\n    });\n  }\n\n  return { ok: true, messages, turns: maxTurns, truncated: true };\n}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/handsfree/src/cua-runner.mjs#L48-L84","documentation":"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).","triggerScenarios":"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.","commonSituations":"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`.","solutions":["Inspect onProgress events just before the throw — the summarizeAction output shows which action failed and its target coordinates.","Re-run with a fresh screenshot first: stale coordinates from an old screenshot are the most common cause of failed clicks.","Check the callTool bridge (CDP connection, browser session) is still alive; re-establish if disconnected.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runCuaLoop(opts);\n} catch (e) {\n  if (e.message.startsWith(\"Computer action failed:\")) {\n    await callTool(\"cua_screenshot\", {}); // refresh state, then retry turn\n  } else throw e;\n}","preventionTips":["Always take a fresh screenshot before coordinate-based actions","Keep the CDP/browser session health-checked between turns","Return a descriptive `error` field from your tool bridge so failures aren't opaque"],"tags":["computer-use","automation","action-failed"],"backgroundTag":"automation-action-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}