{"record":{"id":"2c9e6957d3c5463d","repo":"paperclipai/paperclip","slug":"action-not-pending","errorCode":"action_not_pending","errorMessage":"Tool action request is no longer pending","messagePattern":"Tool action request is no longer pending","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":409,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":5414,"sourceCode":"  function storedInvocationResult(invocation: typeof toolInvocations.$inferSelect): unknown {\n    const summary = invocation.resultSummary?.summary;\n    if (typeof summary !== \"string\") return null;\n    try {\n      return JSON.parse(summary);\n    } catch {\n      return summary;\n    }\n  }\n\n  async function actionRequestResolution(actionRequest: typeof toolActionRequests.$inferSelect) {\n    if (actionRequest.status !== \"executed\" && actionRequest.status !== \"failed\") return actionRequest;\n    const [invocation] = await db\n      .select()\n      .from(toolInvocations)\n      .where(eq(toolInvocations.id, actionRequest.invocationId))\n      .limit(1);\n    return {\n      ...actionRequest,\n      resultSummary: invocation?.resultSummary?.summary ?? null,\n      error: invocation?.errorMessage ?? null,\n    };\n  }\n\n  async function markApprovedActionFailed(input: {\n    actionRequestId: string;\n    invocationId: string;\n    claimUpdatedAt: Date;\n    expectedInvocationStatus: \"awaiting_approval\" | \"executing\";\n    error: unknown;\n  }) {\n    const reasonCode = input.error instanceof ToolGatewayHttpError\n      ? input.error.reasonCode\n      : \"tool_execution_failed\";\n    const message = input.error instanceof Error ? input.error.message : String(input.error);\n    const now = new Date();\n    const settled = await db.transaction(async (tx) => {","sourceCodeStart":5396,"sourceCodeEnd":5432,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L5396-L5432","documentation":"Optimistic-concurrency guard when resolving a tool action request: the request's status is no longer pending (already decided, expired, or cancelled) or the signed payload can no longer be read. The 409 asks the client to refresh the review queue because the row changed under it.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:5246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The request is no longer pending (already resolved). Refresh its state before acting."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}