{"record":{"id":"4c31952040c13c2b","repo":"grafana/k6","slug":"encoding-series-as-protobuf-write-request-failed","errorCode":null,"errorMessage":"encoding series as protobuf write request failed: %w","messagePattern":"encoding series as protobuf write request failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/prometheusrw/remote/client.go","lineNumber":127,"sourceCode":"\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\t_, err = io.Copy(io.Discard, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn validateResponseStatus(resp.StatusCode)\n}\n\nfunc newWriteRequestBody(series []*prompb.TimeSeries) ([]byte, error) {\n\tb, err := proto.Marshal(&prompb.WriteRequest{\n\t\tTimeseries: series,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"encoding series as protobuf write request failed: %w\", err)\n\t}\n\tif snappy.MaxEncodedLen(len(b)) < 0 {\n\t\treturn nil, fmt.Errorf(\"the protobuf message is too large to be handled by Snappy encoder; \"+\n\t\t\t\"size: %d, limit: %d\", len(b), uint64(math.MaxUint32))\n\t}\n\treturn snappy.Encode(nil, b), nil\n}\n\nfunc validateResponseStatus(code int) error {\n\tif code >= http.StatusOK && code < 300 {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"got status code: %d instead expected a 2xx successful status code\", code)\n}\n","sourceCodeStart":109,"sourceCodeEnd":143,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/output/prometheusrw/remote/client.go#L109-L143","documentation":"proto.Marshal failed while serializing the collected TimeSeries into a prompb.WriteRequest. This is an internal serialization failure of the Prometheus remote write output, not a configuration problem.","triggerScenarios":"Thrown at internal/output/prometheusrw/remote/client.go:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the test run; transient marshal failures are not expected","Report a bug to k6 with the script and metrics that triggered it","Reduce custom labels/series complexity to isolate the cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}