{"record":{"id":"5c13d130bcb42f61","repo":"thanos-io/thanos","slug":"open-temporary-block-blockdir","errorCode":null,"errorMessage":"open temporary block blockDir","messagePattern":"open temporary block blockDir","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/downsample/streamed_block_writer.go","lineNumber":192,"sourceCode":"\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 {\n\t\treturn errors.Wrap(err, \"open temporary block blockDir\")\n\t}\n\n\tdefer runutil.CloseWithErrCapture(&err, df, \"close temporary block blockDir\")\n\n\tif err := fileutil.Fdatasync(df); err != nil {\n\t\treturn errors.Wrap(err, \"sync temporary blockDir\")\n\t}\n\n\treturn nil\n}\n\n// writeMetaFile writes meta file.\nfunc (w *streamedBlockWriter) writeMetaFile() error {\n\tw.meta.Version = metadata.TSDBVersion1\n\tw.meta.Thanos.Source = metadata.CompactorSource\n\tw.meta.Thanos.SegmentFiles = block.GetSegmentFiles(w.blockDir)\n\tw.meta.Stats.NumChunks = w.totalChunks\n\tw.meta.Stats.NumSamples = w.totalSamples","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/downsample/streamed_block_writer.go#L174-L210","documentation":"Wraps fileutil.OpenDir in streamedBlockWriter.syncDir: the temporary block directory being finalized could not be opened for fsync (it vanished, permissions changed, or was never fully created). The downsampled block cannot be made durable.","triggerScenarios":"Thrown at pkg/compact/downsample/streamed_block_writer.go:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the block directory path exists before Close.","Check permissions on the temporary block directory.","Inspect the wrapped OS error (ENOENT, EACCES) for the root cause."],"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"}