{"record":{"id":"a8481169c3f14e1f","repo":"thanos-io/thanos","slug":"create-temp-dir","errorCode":null,"errorMessage":"create temp dir","messagePattern":"create temp dir","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/indexheader/parallel_bucket.go","lineNumber":157,"sourceCode":"type Part interface {\n\tRead(buf []byte) (int, error)\n\tWrite(buf []byte) (int, error)\n\tFlush() error\n}\n\n// partFile stores parts in temporary files.\ntype partFile struct {\n\tfile       *os.File\n\tfileWriter *bufio.Writer\n\tfileReader *bufio.Reader\n}\n\nfunc newPartFile(filename string) (*partFile, error) {\n\tdir := filepath.Dir(filename)\n\tdf, err := fileutil.OpenDir(dir)\n\tif os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(dir, os.ModePerm); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"create temp dir\")\n\t\t}\n\t\tdf, err = fileutil.OpenDir(dir)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"open temp dir\")\n\t}\n\n\tif err := df.Sync(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"sync dir\")\n\t}\n\n\tif err := os.RemoveAll(filename); err != nil {\n\t\treturn nil, errors.Wrap(err, \"remove existing file\")\n\t}\n\tf, err := os.OpenFile(filepath.Clean(filename), os.O_CREATE|os.O_RDWR, 0600)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"open temp file\")\n\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/indexheader/parallel_bucket.go#L139-L175","documentation":"Wraps os.MkdirAll in newPartFile: the parent directory for an index-header part file does not exist and could not be created (permissions, read-only filesystem). This is the fallback branch taken when fileutil.OpenDir reported IsNotExist; part caching to temp files cannot proceed.","triggerScenarios":"Thrown at pkg/block/indexheader/parallel_bucket.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions on the temp directory path","Free disk space if full","Ensure the path is not a regular file"],"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"}