{"record":{"id":"2bb04a1c0d365d54","repo":"paperclipai/paperclip","slug":"paperclip-bridge-queue-dir-and-paperclip-bridge-to","errorCode":null,"errorMessage":"PAPERCLIP_BRIDGE_QUEUE_DIR and PAPERCLIP_BRIDGE_TOKEN are required.","messagePattern":"PAPERCLIP_BRIDGE_QUEUE_DIR and PAPERCLIP_BRIDGE_TOKEN are required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/sandbox-callback-bridge.ts","lineNumber":1982,"sourceCode":"      responseHeaders = {};\n      for (const [key, value] of Object.entries(headers)) {\n        if (key.startsWith(\":\") || value == null) continue;\n        responseHeaders[key] = Array.isArray(value) ? value.join(\", \") : String(value);\n      }\n    });\n    stream.on(\"data\", (chunk: Buffer) => chunks.push(chunk));\n    stream.once(\"end\", () => settle(() => resolve({ status, headers: responseHeaders, body: Buffer.concat(chunks) })));\n    stream.once(\"error\", (error) =>\n      settle(() => reject(error instanceof Error ? error : new Error(String(error)))),\n    );\n    stream.once(\"aborted\", () => settle(() => reject(new Error(\"Bridge HTTP/2 stream aborted.\"))));\n    if (request.body.length > 0) {\n      stream.end(request.body);\n    } else if (!stream.writableEnded) {\n      stream.end();\n    }\n  });\n}\n\n/**\n * Create the sandbox HTTP/2 client gateway. It opens one HTTP/2 client\n * session on the transport `createConnection` returns, and forwards each\n * local request the caller hands it (already checked against the bridge\n * token — see {@link SandboxHttp2BridgeGatewayRequest.receivedToken}) as one\n * HTTP/2 stream. It keeps the header allowlist on the sandbox side, exactly\n * as the file-mode gateway does.\n */\nexport function createSandboxHttp2BridgeGateway(\n  options: CreateSandboxHttp2BridgeGatewayOptions,\n): SandboxHttp2BridgeGateway {\n  const authority = options.authority?.trim() || SANDBOX_HTTP2_GATEWAY_DEFAULT_AUTHORITY;\n  const headerAllowlist = options.headerAllowlist ?? DEFAULT_SANDBOX_CALLBACK_BRIDGE_HEADER_ALLOWLIST;\n  const session = http2.connect(`http://${authority}`, {\n    createConnection: options.createConnection,\n  });\n  // A session-level fault fails every in-flight `forwardRequest` call through","sourceCodeStart":1964,"sourceCodeEnd":2000,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/adapter-utils/src/sandbox-callback-bridge.ts#L1964-L2000","documentation":"The sandbox callback bridge startup found PAPERCLIP_BRIDGE_QUEUE_DIR or PAPERCLIP_BRIDGE_TOKEN unset; both environment variables are mandatory for the bridge to exchange queued requests with the host.","triggerScenarios":"Thrown at packages/adapter-utils/src/sandbox-callback-bridge.ts:1730 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set PAPERCLIP_BRIDGE_QUEUE_DIR and PAPERCLIP_BRIDGE_TOKEN in the sandbox environment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-21T17:58:32.592Z","contentChangedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}