{"record":{"id":"1182fa11d04bb0bc","repo":"paperclipai/paperclip","slug":"cloud-portfolio-upstream-error","errorCode":"cloud_portfolio_upstream_error","errorMessage":"Paperclip Cloud portfolio request failed","messagePattern":"Paperclip Cloud portfolio request failed","errorType":"http","errorClass":"HttpError","httpStatus":502,"severity":"error","filePath":"server/src/routes/cloud.ts","lineNumber":86,"sourceCode":"    }\n\n    try {\n      const upstream = await fetchImpl(portfolioUrl, {\n        method: \"GET\",\n        headers: {\n          accept: \"application/json\",\n          authorization: `Bearer ${tenantToken}`,\n          \"x-paperclip-cloud-user-id\": actorUserId,\n          \"x-paperclip-cloud-stack-id\": context.stackId,\n        },\n        signal: AbortSignal.timeout(10_000),\n      });\n      if (!upstream.ok) {\n        logger.warn(\n          { status: upstream.status, stackId: context.stackId },\n          \"Paperclip Cloud portfolio request failed\",\n        );\n        throw new HttpError(502, \"Paperclip Cloud portfolio request failed\", {\n          code: \"cloud_portfolio_upstream_error\",\n        });\n      }\n\n      let payload: unknown;\n      try {\n        payload = await upstream.json();\n      } catch {\n        throw new HttpError(502, \"Paperclip Cloud portfolio returned invalid JSON\", {\n          code: \"cloud_portfolio_invalid_response\",\n        });\n      }\n      portfolioCache.set(cacheKey, {\n        expiresAt: currentTime + cacheTtlMs,\n        payload,\n      });\n      res.setHeader(\"Cache-Control\", \"no-store\");\n      res.json(payload);","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/routes/cloud.ts#L68-L104","documentation":"Upstream proxy failure in the /stacks route: the fetch to the Paperclip Cloud portfolio URL returned a non-2xx status (after a warn log with the status and stackId). Mapped to HTTP 502 — the failure belongs to the upstream portfolio service, not this instance.","triggerScenarios":"Thrown at server/src/routes/cloud.ts:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity and the Paperclip Cloud service status, then retry.","Inspect server logs for the upstream failure details."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}