grafana/k6 · error
the Protobuf message is too large to be handled by Snappy en
Error message
the Protobuf message is too large to be handled by Snappy encoder; size: %d, limit: %d
What it means
In newRequestBody, snappy.MaxEncodedLen returned a negative value for the marshalled Protobuf message, meaning the message exceeds the maximum size the Snappy encoder can handle (~2GB). A single batched MetricSet payload grew beyond the encoder's representable limit.
Source
Thrown at output/cloud/expv2/metrics_client.go:103
err = mc.httpClient.Do(req, nil)
if err != nil {
return err
}
return nil
}
func newRequestBody(data *pbcloud.MetricSet) ([]byte, error) {
b, err := proto.Marshal(data)
if err != nil {
return nil, fmt.Errorf("encoding metrics as Protobuf write request failed: %w", err)
}
// TODO: use the framing format
// https://github.com/google/snappy/blob/main/framing_format.txt
// It can be done replacing the encode with
// https://pkg.go.dev/github.com/klauspost/compress/snappy#NewBufferedWriter
if snappy.MaxEncodedLen(len(b)) < 0 {
return nil, fmt.Errorf("the Protobuf message is too large to be handled by Snappy encoder; "+
"size: %d, limit: %d", len(b), 0xffffffff)
}
return snappy.Encode(nil, b), nil
}
View on GitHub (pinned to 01ffac6f24)
Solutions
- Reduce the volume of metrics emitted per aggregation window (fewer tags, fewer custom metrics)
- Shorten the aggregation period so batches stay small
- Report to grafana/k6 — the client should split oversized payloads rather than fail
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at output/cloud/expv2/metrics_client.go:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/24df9cfe13bdcbd5.
Report an issue: GitHub.