{"record":{"id":"bb434479aaef4793","repo":"thanos-io/thanos","slug":"failed-to-run-post-compaction-callback-for-result","errorCode":null,"errorMessage":"failed to run post compaction callback for result block %s","messagePattern":"failed to run post compaction callback for result block (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/compact.go","lineNumber":1363,"sourceCode":"\t\t// unless vertical compaction is enabled.\n\t\tif !cg.enableVerticalCompaction {\n\t\t\tif err := cg.areBlocksOverlapping(newMeta, toCompact...); err != nil {\n\t\t\t\treturn false, nil, halt(errors.Wrapf(err, \"resulted compacted block %s overlaps with something\", bdir))\n\t\t\t}\n\t\t}\n\n\t\tbegin = time.Now()\n\n\t\terr = tracing.DoInSpanWithErr(ctx, \"compaction_block_upload\", func(ctx context.Context) error {\n\t\t\treturn block.Upload(ctx, cg.logger, cg.bkt, bdir, cg.hashFunc, objstore.WithUploadConcurrency(cg.blockFilesConcurrency))\n\t\t})\n\t\tif err != nil {\n\t\t\treturn false, nil, retry(errors.Wrapf(err, \"upload of %s failed\", compID))\n\t\t}\n\t\tlevel.Info(cg.logger).Log(\"msg\", \"uploaded block\", \"result_block\", compID, \"duration\", time.Since(begin), \"duration_ms\", time.Since(begin).Milliseconds())\n\t\tlevel.Info(cg.logger).Log(\"msg\", \"running post compaction callback\", \"result_block\", compID)\n\t\tif err := compactionLifecycleCallback.PostCompactionCallback(ctx, cg.logger, cg, compID); err != nil {\n\t\t\treturn false, nil, retry(errors.Wrapf(err, \"failed to run post compaction callback for result block %s\", compID))\n\t\t}\n\t\tlevel.Info(cg.logger).Log(\"msg\", \"finished running post compaction callback\", \"result_block\", compID)\n\t}\n\n\t// Mark for deletion the blocks we just compacted from the group and bucket so they do not get included\n\t// into the next planning cycle.\n\t// Eventually the block we just uploaded should get synced into the group again (including sync-delay).\n\tfor _, meta := range toCompact {\n\t\tif err := tracing.DoInSpanWithErr(ctx, \"compaction_block_delete\", func(ctx context.Context) error {\n\t\t\treturn cg.deleteBlock(meta.ULID, filepath.Join(dir, meta.ULID.String()), blockDeletableChecker)\n\t\t}, opentracing.Tags{\"block.id\": meta.ULID}); err != nil {\n\t\t\treturn false, nil, retry(errors.Wrapf(err, \"mark old block for deletion from bucket\"))\n\t\t}\n\t\tcg.groupGarbageCollectedBlocks.Inc()\n\t}\n\n\tlevel.Info(cg.logger).Log(\"msg\", \"finished compacting blocks\", \"duration\", time.Since(groupCompactionBegin),\n\t\t\"duration_ms\", time.Since(groupCompactionBegin).Milliseconds(), \"result_blocks\", compIDStrs, \"source_blocks\", sourceBlockStr)","sourceCodeStart":1345,"sourceCodeEnd":1381,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/compact.go#L1345-L1381","documentation":"Wraps compactionLifecycleCallback.PostCompactionCallback for an already-uploaded result block: the registered post-compaction hook (e.g. cache invalidation or downstream notification) failed after the block was committed to the bucket. The error is retryable — the callback may re-run for the same block.","triggerScenarios":"Thrown at pkg/compact/compact.go:1363 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the callback's underlying error","Check bucket permissions for cleanup operations","Allow the compactor to retry"],"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"}