{"record":{"id":"38336dae0cec2619","repo":"paperclipai/paperclip","slug":"formal-approval-required","errorCode":"formal_approval_required","errorMessage":"Tool action request requires formal board approval before execution","messagePattern":"Tool action request requires formal board approval before execution","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":409,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":9380,"sourceCode":"        throw new ToolGatewayHttpError(\n          409,\n          \"Tool action request is no longer approvable; refresh the review queue\",\n          \"action_request_invalidated\",\n        );\n      }\n      if (actionRequest.approvalId) {\n        const [formalApproval] = await db\n          .select({ status: approvals.status })\n          .from(approvals)\n          .where(\n            and(\n              eq(approvals.id, actionRequest.approvalId),\n              eq(approvals.companyId, input.companyId),\n            ),\n          )\n          .limit(1);\n        if (!formalApproval || formalApproval.status !== \"approved\") {\n          throw new ToolGatewayHttpError(\n            409,\n            \"Tool action request requires formal board approval before execution\",\n            \"formal_approval_required\",\n            { approvalId: actionRequest.approvalId },\n          );\n        }\n      }\n      if (actionRequest.status === \"approved\") {\n        await reflectToolActionInteractionLifecycle({\n          actionRequestId: actionRequest.id,\n          status: \"approved\",\n        });\n        if (\n          !isTestOriginInvocation(invocation) &&\n          signedPayload.executionOnApprove === true\n        ) {\n          try {\n            await executeApprovedAgentInvocation({ actionRequest, invocation });","sourceCodeStart":9362,"sourceCodeEnd":9398,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L9362-L9398","documentation":"Governance guard during approval resolution: the action request references a formal approvals row that is missing or not in approved status. The 409 formal_approval_required blocks execution until the board formally approves the linked approval record, since this action was configured to require formal approval.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:5282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This action requires formal board approval; route it through the board approval flow instead of executing directly."],"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"}