{"record":{"id":"caf50e86319a3df9","repo":"thanos-io/thanos","slug":"create-compactor","errorCode":null,"errorMessage":"create compactor","messagePattern":"create compactor","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":347,"sourceCode":"\tswitch conf.dedupFunc {\n\tcase compact.DedupAlgorithmPenalty:\n\t\tmergeFunc = dedup.NewChunkSeriesMerger()\n\n\t\tif len(dedupReplicaLabels) == 0 {\n\t\t\treturn errors.New(\"penalty based deduplication needs at least one replica label specified\")\n\t\t}\n\tcase \"\":\n\t\tmergeFunc = storage.NewCompactingChunkSeriesMerger(storage.ChainedSeriesMerge)\n\n\tdefault:\n\t\treturn errors.Errorf(\"unsupported deduplication func, got %s\", conf.dedupFunc)\n\t}\n\n\t// Instantiate the compactor with different time slices. Timestamps in TSDB\n\t// are in milliseconds.\n\tcomp, err := tsdb.NewLeveledCompactor(ctx, reg, logutil.GoKitLogToSlog(logger), levels, downsample.NewPool(), mergeFunc)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create compactor\")\n\t}\n\n\tvar (\n\t\tcompactDir      = path.Join(conf.dataDir, \"compact\")\n\t\tdownsamplingDir = path.Join(conf.dataDir, \"downsample\")\n\t)\n\n\tif err := os.MkdirAll(compactDir, os.ModePerm); err != nil {\n\t\treturn errors.Wrap(err, \"create working compact directory\")\n\t}\n\n\tif err := os.MkdirAll(downsamplingDir, os.ModePerm); err != nil {\n\t\treturn errors.Wrap(err, \"create working downsample directory\")\n\t}\n\n\tgrouper := compact.NewDefaultGrouper(\n\t\tlogger,\n\t\tinsBkt,","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L329-L365","documentation":"Wraps an error from tsdb.NewLeveledCompactor when instantiating the leveled compactor with the computed levels, downsample pool and merge func. Failures are rare and typically mean the compactor could not be initialized (e.g. invalid levels slice or pool creation failure).","triggerScenarios":"tsdb.NewLeveledCompactor returns an error during startup, most plausibly from internal initialization with the given levels/mergeFunc parameters.","commonSituations":"Practically seen only with corrupted upstream setups, custom builds with modified level lists, or memory/registration issues during process bring-up.","solutions":["Inspect the wrapped cause in logs and address the underlying initialization error.","Verify --max-compaction-level produces a sane levels list (see related level errors).","Retry startup; report to Thanos upstream if it reproduces with default flags."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runCompact(...); err != nil {\n    if strings.Contains(err.Error(), \"create compactor\") {\n        logger.Error(err, \"compactor init failed; verify flags/levels and retry with defaults\")\n    }\n    return err\n}","preventionTips":["Run with default flags first to isolate custom level/merge settings","Upgrade Thanos as a unit rather than patching internal components","Report reproducible init failures upstream with the wrapped cause"],"tags":["startup","compaction","tsdb"],"backgroundTag":"module-init-failed","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"}