{"record":{"id":"3ecb37d3dc74a2e3","repo":"multica-ai/multica","slug":"cloud-runtime-response-exceeds-d-bytes","errorCode":null,"errorMessage":"cloud runtime response exceeds %d bytes","messagePattern":"cloud runtime response exceeds (.+?) bytes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/cloudruntime/client.go","lineNumber":188,"sourceCode":"\tif req.UserID != \"\" {\n\t\thttpReq.Header.Set(\"X-User-ID\", req.UserID)\n\t}\n\tif req.RequestID != \"\" {\n\t\thttpReq.Header.Set(\"X-Request-ID\", req.RequestID)\n\t}\n\n\tresp, err := c.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdata, err := io.ReadAll(io.LimitReader(resp.Body, maxResponseBodySize+1))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(data) > maxResponseBodySize {\n\t\treturn nil, fmt.Errorf(\"cloud runtime response exceeds %d bytes\", maxResponseBodySize)\n\t}\n\treturn &Response{\n\t\tStatusCode: resp.StatusCode,\n\t\tHeader:     resp.Header.Clone(),\n\t\tBody:       data,\n\t}, nil\n}\n\n// inferCloudRuntimeOp returns the symbolic op label for the request metric.\n// Callers may pin Request.Op explicitly; otherwise the bucket is derived\n// from the path so existing call sites don't need to change.\nfunc inferCloudRuntimeOp(op, method, path string) string {\n\top = strings.ToLower(strings.TrimSpace(op))\n\tif op != \"\" {\n\t\treturn op\n\t}\n\tswitch {\n\tcase strings.Contains(path, \"/billing\"):","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/cloudruntime/client.go#L170-L206","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the actual Content-Length of the failing endpoint to confirm the payload genuinely exceeds the cap","If the large payload is legitimate, raise maxResponseBodySize in the client to match the server's documented maximum","Better: fix the server endpoint to paginate or trim the payload below the client cap","Verify client and server versions are compatible (no version skew)"],"exampleFix":"// before\ndata, err := io.ReadAll(io.LimitReader(resp.Body, maxResponseBodySize+1))\nif err != nil {\n    return nil, err\n}\nif len(data) > maxResponseBodySize {\n    return nil, fmt.Errorf(\"cloud runtime response exceeds %d bytes\", maxResponseBodySize)\n}\n\n// after: make the cap configurable per client so deployments with bigger payloads can opt in\ncfg := DefaultConfig()\ncfg.MaxResponseBodySize = 16 << 20 // 16 MiB\nclient := cloudruntime.NewClient(baseURL, cfg)","handlingStrategy":"validation","validationCode":"// Before sending, check Content-Length when the server provides it.\nif respHeader := resp.Header.Get(\"Content-Length\"); respHeader != \"\" {\n    if n, _ := strconv.Atoi(respHeader); n > maxResponseBodySize {\n        return fmt.Errorf(\"cloud runtime response will exceed %d bytes (Content-Length=%d)\", maxResponseBodySize, n)\n    }\n}","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Keep client and server versions aligned so caps and payloads agree","Prefer paginated endpoints for large collections","Document the response size cap as part of the API contract"],"tags":["cloud-runtime","limits","payload-size","http"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}