VictoriaMetrics/VictoriaMetrics · error
cannot read metricName size: %w
Error message
cannot read metricName size: %w
What it means
Reading the 4-byte metricName size prefix failed with a non-EOF error mid-stream: the native payload ended abruptly or the reader errored between blocks.
Source
Thrown at lib/protoparser/native/stream/streamparser.go:68
ctx := &streamContext{}
for {
uw := getUnmarshalWork()
uw.tr = tr
uw.ctx = ctx
uw.callback = callback
// Read uw.metricNameBuf
if _, err := io.ReadFull(br, sizeBuf); err != nil {
if err == io.EOF {
// End of stream
putUnmarshalWork(uw)
ctx.wg.Wait()
return ctx.err
}
readErrors.Inc()
ctx.wg.Wait()
return fmt.Errorf("cannot read metricName size: %w", err)
}
readCalls.Inc()
bufSize := encoding.UnmarshalUint32(sizeBuf)
if bufSize > 1024*1024 {
parseErrors.Inc()
ctx.wg.Wait()
return fmt.Errorf("too big metricName size; got %d; shouldn't exceed %d", bufSize, 1024*1024)
}
uw.metricNameBuf = bytesutil.ResizeNoCopyMayOverallocate(uw.metricNameBuf, int(bufSize))
if _, err := io.ReadFull(br, uw.metricNameBuf); err != nil {
readErrors.Inc()
ctx.wg.Wait()
return fmt.Errorf("cannot read metricName with size %d bytes: %w", bufSize, err)
}
readCalls.Inc()
// Read uw.blockBuf
if _, err := io.ReadFull(br, sizeBuf); err != nil {View on GitHub (pinned to 5079fb58f1)
Solutions
- Re-export and re-upload the native data — the stream is truncated
- Check network stability and proxy timeouts during upload
- Confirm nothing appended extra bytes to the export file
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at lib/protoparser/native/stream/streamparser.go:68 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/35bb286547b05d77.
Report an issue: GitHub.