paperclipai/paperclip · error · HttpError

cloud_portfolio_upstream_error

cloud_portfolio_upstream_error

Error message

Paperclip Cloud portfolio request failed

What it means

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.

Source

Thrown at server/src/routes/cloud.ts:86

    }

    try {
      const upstream = await fetchImpl(portfolioUrl, {
        method: "GET",
        headers: {
          accept: "application/json",
          authorization: `Bearer ${tenantToken}`,
          "x-paperclip-cloud-user-id": actorUserId,
          "x-paperclip-cloud-stack-id": context.stackId,
        },
        signal: AbortSignal.timeout(10_000),
      });
      if (!upstream.ok) {
        logger.warn(
          { status: upstream.status, stackId: context.stackId },
          "Paperclip Cloud portfolio request failed",
        );
        throw new HttpError(502, "Paperclip Cloud portfolio request failed", {
          code: "cloud_portfolio_upstream_error",
        });
      }

      let payload: unknown;
      try {
        payload = await upstream.json();
      } catch {
        throw new HttpError(502, "Paperclip Cloud portfolio returned invalid JSON", {
          code: "cloud_portfolio_invalid_response",
        });
      }
      portfolioCache.set(cacheKey, {
        expiresAt: currentTime + cacheTtlMs,
        payload,
      });
      res.setHeader("Cache-Control", "no-store");
      res.json(payload);

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Check network connectivity and the Paperclip Cloud service status, then retry.
  2. Inspect server logs for the upstream failure details.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/src/routes/cloud.ts:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/1182fa11d04bb0bc. Report an issue: GitHub.