{"record":{"id":"d8ac77eb01f3b3b4","repo":"thanos-io/thanos","slug":"build-compaction-groups","errorCode":null,"errorMessage":"build compaction groups","messagePattern":"build compaction groups","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/compact.go","lineNumber":1587,"sourceCode":"\t\t}\n\n\t\tvar ignoreBlocks map[ulid.ULID]struct{}\n\t\tif c.blocksCleaner != nil {\n\t\t\tdeletedBlocks, err := c.blocksCleaner.DeleteMarkedBlocks(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"cleaning marked blocks\")\n\t\t\t}\n\t\t\tignoreBlocks = deletedBlocks\n\t\t}\n\n\t\tlevel.Info(c.logger).Log(\"msg\", \"start of initial garbage collection\")\n\t\tif err := c.sy.GarbageCollect(ctx, ignoreBlocks); err != nil {\n\t\t\treturn errors.Wrap(err, \"garbage\")\n\t\t}\n\n\t\tgroups, err := c.grouper.Groups(c.sy.Metas())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"build compaction groups\")\n\t\t}\n\n\t\tignoreDirs := []string{}\n\t\tfor _, gr := range groups {\n\t\t\tfor _, grID := range gr.IDs() {\n\t\t\t\tignoreDirs = append(ignoreDirs, filepath.Join(gr.Key(), grID.String()))\n\t\t\t}\n\t\t}\n\n\t\tif err := runutil.DeleteAll(c.compactDir, ignoreDirs...); err != nil {\n\t\t\tlevel.Warn(c.logger).Log(\"msg\", \"failed deleting non-compaction group directories/files, some disk space usage might have leaked. Continuing\", \"err\", err, \"dir\", c.compactDir)\n\t\t}\n\n\t\tlevel.Info(c.logger).Log(\"msg\", \"start of compactions\")\n\n\t\t// Send all groups found during this pass to the compaction workers.\n\t\tvar groupErrs errutil.MultiError\n\tgroupLoop:","sourceCodeStart":1569,"sourceCodeEnd":1605,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/compact.go#L1569-L1605","documentation":"Wraps grouper.Groups when partitioning the synced block metadata into compaction groups: the grouping criteria (labels, resolution, time ranges) could not be applied — typically conflicting or malformed Thanos metadata among blocks. No compaction plan can be built.","triggerScenarios":"Thrown at pkg/compact/compact.go:1587 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify overlapping blocks from the wrapped error","Remove duplicate/overlapping blocks or enable vertical compaction","Check for multiple compactors writing to the bucket"],"exampleFix":null,"handlingStrategy":"validation","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"}