{"record":{"id":"2724bdb975ec2716","repo":"paperclipai/paperclip","slug":"bridge-response-body-exceeded-the-configured-size","errorCode":null,"errorMessage":"Bridge response body exceeded the configured size limit of ${maxBodyBytes} bytes.","messagePattern":"Bridge response body exceeded the configured size limit of (.+?) bytes\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/sandbox-callback-bridge.ts","lineNumber":1112,"sourceCode":"          completedAt: new Date().toISOString() });\n        return;\n      }\n      const denialReason = await authorizeRequest(request);\n      if (denialReason) {\n        await finalize({\n          id: request.id,\n          status: 403,\n          headers: { \"content-type\": \"application/json\" },\n          body: JSON.stringify({ error: denialReason }),\n          completedAt: new Date().toISOString(),\n        });\n        return;\n      }\n\n      // Claim the request for the handler before the host operation starts. When\n      // the recovery path already claimed it, it writes a 503 and the caller may\n      // retry, so do not run the mutation; the retry then applies it once. When\n      // the handler claims first, the recovery path leaves the request alone and\n      // the handler writes the real response.\n      if (!claimForHandler()) {\n        return;\n      }\n\n      // Build the response, then finalize once. The handler already holds the\n      // claim, so `finalize` writes the real response.\n      let response: SandboxCallbackBridgeResponse;\n      let handlerReturned = false;\n      try {\n        const { bodyEncoding, ...forwardRequest } = request;\n        const result = await input.handleRequest({ ...forwardRequest,\n          body: bodyEncoding === \"base64\" ? decodeSandboxBridgeBody(request, maxBodyBytes) : request.body,\n        }, { signal: guard.controller.signal, reservation });\n        handlerReturned = true;\n        const responseBytes = Buffer.byteLength(result.body ?? \"\");\n        if (responseBytes > maxBodyBytes) throw new Error(\"Bridge response body exceeded the configured size limit.\");\n        if (!reservation.reserve(4 * sandboxBridgeEnvelopeLimit(responseBytes))) {","sourceCodeStart":1094,"sourceCodeEnd":1130,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapter-utils/src/sandbox-callback-bridge.ts#L1094-L1130","documentation":"Size-limit enforcement in the sandbox callback bridge worker: the response body the handler produced exceeds the configured maxBodyBytes cap, so it is refused rather than being shipped through the size-bounded bridge channel.","triggerScenarios":"Thrown at packages/adapter-utils/src/sandbox-callback-bridge.ts:981 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the bridge response body size below ${maxBodyBytes} bytes.","Raise the configured body size limit if large responses are expected."],"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"}