VictoriaMetrics/VictoriaMetrics · error

invalid ValuesBlockOffset at block header at offset %d; got

Error message

invalid ValuesBlockOffset at block header at offset %d; got %d; want %d

What it means

readBlock validates that the block header's ValuesBlockOffset matches the reader's expected sequential values block offset. A mismatch means the block does not point at the values data where the stream expects it, i.e. the part's block/index layout is inconsistent or corrupted, so the stream read is aborted.

Source

Thrown at lib/storage/block_stream_reader.go:272

		return fmt.Errorf("invalid MinTimestamp at block header at offset %d; got %d; cannot be smaller than %d",
			bsr.prevIndexBlockOffset(), bsr.Block.bh.MinTimestamp, bsr.ph.MinTimestamp)
	}
	if bsr.Block.bh.MaxTimestamp > bsr.ph.MaxTimestamp {
		return fmt.Errorf("invalid MaxTimestamp at block header at offset %d; got %d; cannot be bigger than %d",
			bsr.prevIndexBlockOffset(), bsr.Block.bh.MaxTimestamp, bsr.ph.MaxTimestamp)
	}
	usePrevTimestamps := len(bsr.prevTimestampsData) > 0 && bsr.Block.bh.TimestampsBlockOffset == bsr.prevTimestampsBlockOffset
	if usePrevTimestamps {
		if int(bsr.Block.bh.TimestampsBlockSize) != len(bsr.prevTimestampsData) {
			return fmt.Errorf("invalid TimestampsBlockSize at block header at offset %d; got %d; want %d",
				bsr.prevIndexBlockOffset(), bsr.Block.bh.TimestampsBlockSize, len(bsr.prevTimestampsData))
		}
	} else if bsr.Block.bh.TimestampsBlockOffset != bsr.timestampsBlockOffset {
		return fmt.Errorf("invalid TimestampsBlockOffset at block header at offset %d; got %d; want %d",
			bsr.prevIndexBlockOffset(), bsr.Block.bh.TimestampsBlockOffset, bsr.timestampsBlockOffset)
	}
	if bsr.Block.bh.ValuesBlockOffset != bsr.valuesBlockOffset {
		return fmt.Errorf("invalid ValuesBlockOffset at block header at offset %d; got %d; want %d",
			bsr.prevIndexBlockOffset(), bsr.Block.bh.ValuesBlockOffset, bsr.valuesBlockOffset)
	}

	// Read timestamps data.
	if usePrevTimestamps {
		bsr.Block.timestampsData = append(bsr.Block.timestampsData[:0], bsr.prevTimestampsData...)
	} else {
		bsr.Block.timestampsData = bytesutil.ResizeNoCopyMayOverallocate(bsr.Block.timestampsData, int(bsr.Block.bh.TimestampsBlockSize))
		fs.MustReadData(bsr.timestampsReader, bsr.Block.timestampsData)
		bsr.prevTimestampsBlockOffset = bsr.timestampsBlockOffset
		bsr.prevTimestampsData = append(bsr.prevTimestampsData[:0], bsr.Block.timestampsData...)
	}

	// Read values data.
	bsr.Block.valuesData = bytesutil.ResizeNoCopyMayOverallocate(bsr.Block.valuesData, int(bsr.Block.bh.ValuesBlockSize))
	fs.MustReadData(bsr.valuesReader, bsr.Block.valuesData)

	// Update offsets.

View on GitHub (pinned to 5079fb58f1)

Solutions

  1. Stop VM, quarantine the corrupted part file, restart and let VM rebuild/re-ingest
  2. Restore the affected partition from a known-good backup or re-push the data
  3. Check for unterminated writes / power loss damage; enable fsync-aware storage and check filesystem journal
  4. Ensure only VictoriaMetrics itself writes to the storage directories
Defensive patterns

Strategy: validation

Try / catch

if err != nil && strings.Contains(err.Error(), "invalid ValuesBlockOffset") {
    // stop VM, quarantine part, restore from backup or re-push data
}

Prevention

When it happens

Trigger: NextBlock -> readBlock where bh.ValuesBlockOffset != bsr.valuesBlockOffset for the current block.

Common situations: Truncated or externally modified part files, partial restores from backup, disk corruption, third-party tools rewriting parts or index blocks.

Related errors


AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03). Data as JSON: /api/errors/8ebeef929ebb0702. Report an issue: GitHub.