{"record":{"id":"6114037ad90227b1","repo":"thanos-io/thanos","slug":"garbage","errorCode":null,"errorMessage":"garbage","messagePattern":"garbage","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/compact.go","lineNumber":1582,"sourceCode":"\t\t// Blocks that were compacted are garbage collected after each Compaction.\n\t\t// However if compactor crashes we need to resolve those on startup.\n\t\tlevel.Info(c.logger).Log(\"msg\", \"start initial sync of metas\")\n\t\tif err := c.sy.SyncMetas(ctx); err != nil {\n\t\t\treturn errors.Wrap(err, \"sync\")\n\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","sourceCodeStart":1564,"sourceCodeEnd":1600,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/compact.go#L1564-L1600","documentation":"Wraps sy.GarbageCollect during the compactor's initial garbage-collection pass: removing source blocks whose compaction result is already durable failed (bucket delete errors or metadata mismatches). The stale blocks survive and GC is retried on the next cycle.","triggerScenarios":"Thrown at pkg/compact/compact.go:1582 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check bucket permissions for marking/deleting","Inspect wrapped errors for failing blocks","Re-run the compactor; GC retries"],"exampleFix":null,"handlingStrategy":"retry","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"}