multica-ai/multica · error

cloud runtime response exceeds %d bytes

Error message

cloud runtime response exceeds %d bytes

What it means

Cloudruntime Client.doInner caps response bodies at maxResponseBodySize by reading maxResponseBodySize+1 bytes with io.LimitReader; when the read yields more than the cap, the response is discarded and this error returned. It is a guard against unbounded memory use when the cloud runtime returns an unexpectedly large payload.

Source

Thrown at server/internal/cloudruntime/client.go:188

	if req.UserID != "" {
		httpReq.Header.Set("X-User-ID", req.UserID)
	}
	if req.RequestID != "" {
		httpReq.Header.Set("X-Request-ID", req.RequestID)
	}

	resp, err := c.httpClient.Do(httpReq)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	data, err := io.ReadAll(io.LimitReader(resp.Body, maxResponseBodySize+1))
	if err != nil {
		return nil, err
	}
	if len(data) > maxResponseBodySize {
		return nil, fmt.Errorf("cloud runtime response exceeds %d bytes", maxResponseBodySize)
	}
	return &Response{
		StatusCode: resp.StatusCode,
		Header:     resp.Header.Clone(),
		Body:       data,
	}, nil
}

// inferCloudRuntimeOp returns the symbolic op label for the request metric.
// Callers may pin Request.Op explicitly; otherwise the bucket is derived
// from the path so existing call sites don't need to change.
func inferCloudRuntimeOp(op, method, path string) string {
	op = strings.ToLower(strings.TrimSpace(op))
	if op != "" {
		return op
	}
	switch {
	case strings.Contains(path, "/billing"):

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Check the actual Content-Length of the failing endpoint to confirm the payload genuinely exceeds the cap
  2. If the large payload is legitimate, raise maxResponseBodySize in the client to match the server's documented maximum
  3. Better: fix the server endpoint to paginate or trim the payload below the client cap
  4. Verify client and server versions are compatible (no version skew)

Example fix

// before
data, err := io.ReadAll(io.LimitReader(resp.Body, maxResponseBodySize+1))
if err != nil {
    return nil, err
}
if len(data) > maxResponseBodySize {
    return nil, fmt.Errorf("cloud runtime response exceeds %d bytes", maxResponseBodySize)
}

// after: make the cap configurable per client so deployments with bigger payloads can opt in
cfg := DefaultConfig()
cfg.MaxResponseBodySize = 16 << 20 // 16 MiB
client := cloudruntime.NewClient(baseURL, cfg)
Defensive patterns

Strategy: validation

Validate before calling

// Before sending, check Content-Length when the server provides it.
if respHeader := resp.Header.Get("Content-Length"); respHeader != "" {
    if n, _ := strconv.Atoi(respHeader); n > maxResponseBodySize {
        return fmt.Errorf("cloud runtime response will exceed %d bytes (Content-Length=%d)", maxResponseBodySize, n)
    }
}

Try / catch

strings.Contains(err.Error(), "exceeds") or a typed sentinel: treat as non-retryable — retrying the same request reproduces the same oversize body. Fix server payload or raise the cap.

Prevention

When it happens

Trigger: Any cloud runtime request whose response body exceeds the compiled limit — e.g. a list/manifest endpoint that grew past the cap after new content was added server-side, or an error endpoint echoing a huge payload.

Common situations: Server-side payload growth after a release (more bundles, bigger logs), a proxy injecting a large error page, or a version skew where an old client's cap is smaller than what the new server sends.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/3ecb37d3dc74a2e3. Report an issue: GitHub.