{"record":{"id":"8ebeef929ebb0702","repo":"VictoriaMetrics/VictoriaMetrics","slug":"invalid-valuesblockoffset-at-block-header-at-offse","errorCode":null,"errorMessage":"invalid ValuesBlockOffset at block header at offset %d; got %d; want %d","messagePattern":"invalid ValuesBlockOffset at block header at offset (.+?); got (.+?); want (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/storage/block_stream_reader.go","lineNumber":272,"sourceCode":"\t\treturn fmt.Errorf(\"invalid MinTimestamp at block header at offset %d; got %d; cannot be smaller than %d\",\n\t\t\tbsr.prevIndexBlockOffset(), bsr.Block.bh.MinTimestamp, bsr.ph.MinTimestamp)\n\t}\n\tif bsr.Block.bh.MaxTimestamp > bsr.ph.MaxTimestamp {\n\t\treturn fmt.Errorf(\"invalid MaxTimestamp at block header at offset %d; got %d; cannot be bigger than %d\",\n\t\t\tbsr.prevIndexBlockOffset(), bsr.Block.bh.MaxTimestamp, bsr.ph.MaxTimestamp)\n\t}\n\tusePrevTimestamps := len(bsr.prevTimestampsData) > 0 && bsr.Block.bh.TimestampsBlockOffset == bsr.prevTimestampsBlockOffset\n\tif usePrevTimestamps {\n\t\tif int(bsr.Block.bh.TimestampsBlockSize) != len(bsr.prevTimestampsData) {\n\t\t\treturn fmt.Errorf(\"invalid TimestampsBlockSize at block header at offset %d; got %d; want %d\",\n\t\t\t\tbsr.prevIndexBlockOffset(), bsr.Block.bh.TimestampsBlockSize, len(bsr.prevTimestampsData))\n\t\t}\n\t} else if bsr.Block.bh.TimestampsBlockOffset != bsr.timestampsBlockOffset {\n\t\treturn fmt.Errorf(\"invalid TimestampsBlockOffset at block header at offset %d; got %d; want %d\",\n\t\t\tbsr.prevIndexBlockOffset(), bsr.Block.bh.TimestampsBlockOffset, bsr.timestampsBlockOffset)\n\t}\n\tif bsr.Block.bh.ValuesBlockOffset != bsr.valuesBlockOffset {\n\t\treturn fmt.Errorf(\"invalid ValuesBlockOffset at block header at offset %d; got %d; want %d\",\n\t\t\tbsr.prevIndexBlockOffset(), bsr.Block.bh.ValuesBlockOffset, bsr.valuesBlockOffset)\n\t}\n\n\t// Read timestamps data.\n\tif usePrevTimestamps {\n\t\tbsr.Block.timestampsData = append(bsr.Block.timestampsData[:0], bsr.prevTimestampsData...)\n\t} else {\n\t\tbsr.Block.timestampsData = bytesutil.ResizeNoCopyMayOverallocate(bsr.Block.timestampsData, int(bsr.Block.bh.TimestampsBlockSize))\n\t\tfs.MustReadData(bsr.timestampsReader, bsr.Block.timestampsData)\n\t\tbsr.prevTimestampsBlockOffset = bsr.timestampsBlockOffset\n\t\tbsr.prevTimestampsData = append(bsr.prevTimestampsData[:0], bsr.Block.timestampsData...)\n\t}\n\n\t// Read values data.\n\tbsr.Block.valuesData = bytesutil.ResizeNoCopyMayOverallocate(bsr.Block.valuesData, int(bsr.Block.bh.ValuesBlockSize))\n\tfs.MustReadData(bsr.valuesReader, bsr.Block.valuesData)\n\n\t// Update offsets.","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/storage/block_stream_reader.go#L254-L290","documentation":"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.","triggerScenarios":"NextBlock -> readBlock where bh.ValuesBlockOffset != bsr.valuesBlockOffset for the current block.","commonSituations":"Truncated or externally modified part files, partial restores from backup, disk corruption, third-party tools rewriting parts or index blocks.","solutions":["Stop VM, quarantine the corrupted part file, restart and let VM rebuild/re-ingest","Restore the affected partition from a known-good backup or re-push the data","Check for unterminated writes / power loss damage; enable fsync-aware storage and check filesystem journal","Ensure only VictoriaMetrics itself writes to the storage directories"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid ValuesBlockOffset\") {\n    // stop VM, quarantine part, restore from backup or re-push data\n}","preventionTips":["Ensure clean shutdowns (handle SIGTERM, avoid OOM kills)","Use ECC memory and healthy disks","Never run third-party tools that rewrite parts","Verify restored data directories match the running VM version"],"tags":["storage","corruption","victoriametrics","block-offset"],"backgroundTag":"block-header-corruption","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}