{"record":{"id":"dad7bfa7df465d84","repo":"thanos-io/thanos","slug":"finalize","errorCode":null,"errorMessage":"finalize","messagePattern":"finalize","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/downsample/streamed_block_writer.go","lineNumber":173,"sourceCode":"\t\treturn merr.Err()\n\t}\n\n\t// Finalize saves prepared index and metadata to corresponding files.\n\n\tfor _, cl := range w.closers {\n\t\tmerr.Add(cl.Close())\n\t}\n\n\tif err := w.writeMetaFile(); err != nil {\n\t\treturn errors.Wrap(err, \"write meta meta\")\n\t}\n\n\tif err := w.syncDir(); err != nil {\n\t\treturn errors.Wrap(err, \"sync blockDir\")\n\t}\n\n\tif err := merr.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"finalize\")\n\t}\n\n\t// No error, claim success.\n\n\tlevel.Info(w.logger).Log(\n\t\t\"msg\", \"finalized downsampled block\",\n\t\t\"mint\", w.meta.MinTime,\n\t\t\"maxt\", w.meta.MaxTime,\n\t\t\"ulid\", w.meta.ULID,\n\t\t\"resolution\", w.meta.Thanos.Downsample.Resolution,\n\t)\n\treturn nil\n}\n\n// syncDir syncs blockDir on disk.\nfunc (w *streamedBlockWriter) syncDir() (err error) {\n\tdf, err := fileutil.OpenDir(w.blockDir)\n\tif err != nil {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/downsample/streamed_block_writer.go#L155-L191","documentation":"Wraps merr.Err in streamedBlockWriter.Close after index, chunk, and meta files were written: one or more of the accumulated writer Close() calls failed, so although the block looks complete on disk it cannot be trusted and finalization is reported as failed.","triggerScenarios":"Thrown at pkg/compact/downsample/streamed_block_writer.go:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped MultiError to find which closer (index/chunks/meta) failed.","Check disk space and file descriptors for the block directory.","Delete the partial block and re-run downsampling."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}