{"record":{"id":"89b694939b3bbfe5","repo":"paperclipai/paperclip","slug":"action-already-resolved","errorCode":"action_already_resolved","errorMessage":"Tool action request has already been resolved","messagePattern":"Tool action request has already been resolved","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":409,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":7458,"sourceCode":"          updatedAt: now,\n        })\n        .where(\n          and(\n            eq(toolActionRequests.id, input.actionRequestId),\n            eq(toolActionRequests.status, \"executing\"),\n            eq(toolActionRequests.updatedAt, input.claimUpdatedAt),\n          ),\n        );\n      return true;\n    });\n    if (!settled) return { reasonCode, message, settled: false };\n    await reflectToolActionInteractionLifecycle({\n      actionRequestId: input.actionRequestId,\n      status: \"failed\",\n      errorCode: reasonCode,\n      errorMessage: message,\n    });\n    return { reasonCode, message, settled: true };\n  }\n\n  async function expireApprovedActionForManagedArgumentDrift(input: {\n    actionRequestId: string;\n    invocationId: string;\n    toolName: string;\n    ownsExecutingClaim?: boolean;\n  }) {\n    const error = new ToolGatewayHttpError(\n      409,\n      \"Approved tool action managed arguments changed after review; request a new approval\",\n      \"approved_tool_managed_arguments_changed\",\n      {\n        actionRequestId: input.actionRequestId,\n        invocationId: input.invocationId,\n        tool: input.toolName,\n      },\n    );","sourceCodeStart":7440,"sourceCodeEnd":7476,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L7440-L7476","documentation":"Optimistic lock in the approve path: the status update ...where status=pending matched zero rows, so the action request was already resolved (approved/declined/expired) by someone else. The 409 tells the caller the request has already been resolved; re-read it to see the outcome.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:5320 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The request was already resolved. Do not resolve it twice; check its current status."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}