{"record":{"id":"a55b50e59067d86f","repo":"paperclipai/paperclip","slug":"action-issue-closed","errorCode":"action_issue_closed","errorMessage":"The issue for this tool action is closed; the approval has expired","messagePattern":"The issue for this tool action is closed; the approval has expired","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":409,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":7546,"sourceCode":"        and(\n          eq(issues.id, invocation.issueId!),\n          eq(issues.companyId, invocation.companyId),\n        ),\n      )\n      .limit(1);\n    if (issue && issue.status !== \"done\" && issue.status !== \"cancelled\") {\n      return { projectId: issue.projectId };\n    }\n    const expiredAt = new Date();\n    await db\n      .update(toolActionRequests)\n      .set({ status: \"expired\", resolvedAt: expiredAt, updatedAt: expiredAt })\n      .where(eq(toolActionRequests.id, claimed.id));\n    await reflectToolActionInteractionLifecycle({\n      actionRequestId: claimed.id,\n      status: \"expired\",\n    });\n    throw new ToolGatewayHttpError(\n      409,\n      \"The issue for this tool action is closed; the approval has expired\",\n      \"action_issue_closed\",\n      { actionRequestId: claimed.id, invocationId: invocation.id },\n    );\n  }\n\n  async function restoreApprovedActionIdentity(\n    session: ToolGatewaySession,\n    identityContextId: string | undefined,\n  ) {\n    if (!identityContextId) return;\n    const [origin] = await db\n      .select()\n      .from(runIdentityContexts)\n      .where(\n        and(\n          eq(runIdentityContexts.id, identityContextId),","sourceCodeStart":7528,"sourceCodeEnd":7564,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L7528-L7564","documentation":"Post-claim recheck in approved-action execution: the issue tied to the invocation is done or cancelled (or missing), so the claimed approval is expired and marked as such. This closes the race where a claim committed just before terminal-issue expiry revocation, ensuring governed side effects never run for closed issues.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:4137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The issue was closed, expiring the approval. Reopen/use another issue and request a new approval."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}