{"record":{"id":"e31ddffad958cba4","repo":"paperclipai/paperclip","slug":"approval-request-missing","errorCode":"approval_request_missing","errorMessage":"Approval request was not created","messagePattern":"Approval request was not created","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":500,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":2230,"sourceCode":"          instructions:\n            \"This session is not attached to a task, so an approval card cannot be posted. Re-run this action from a run that has the task checked out.\",\n        },\n      );\n    }\n\n    if (!input.actionRequest) {\n      await db\n        .update(toolInvocations)\n        .set({\n          status: \"denied\",\n          errorCode: \"approval_request_missing\",\n          errorMessage:\n            \"Approval-required policy decision did not create an action request\",\n          completedAt: new Date(),\n          updatedAt: new Date(),\n        })\n        .where(eq(toolInvocations.id, input.invocation.id));\n      throw new ToolGatewayHttpError(\n        500,\n        \"Approval request was not created\",\n        \"approval_request_missing\",\n        {\n          invocationId: input.invocation.id,\n          tool: input.tool.name,\n        },\n      );\n    }\n    const actionRequest = input.actionRequest;\n    const expiresAt = new Date(Date.now() + 60 * 60 * 1000);\n\n    let signedArguments: ReturnType<typeof signToolArguments>;\n    try {\n      signedArguments = signToolArguments({\n        invocationId: input.invocation.id,\n        toolName: input.tool.name,\n        canonicalArguments,","sourceCodeStart":2212,"sourceCodeEnd":2248,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L2212-L2248","documentation":"Consistency guard after the policy engine returned require_approval: the expected tool_action_requests row was never created. The invocation is set to denied with errorCode approval_request_missing, indicating an internal invariant break between the policy decision and action-request creation rather than a client input problem.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:1556 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Approval creation failed internally. Retry; if persistent, check server logs for the approval insert failure."],"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"}