{"record":{"id":"d9bf5b762005f5c0","repo":"thanos-io/thanos","slug":"requested-to-mark-for-no-deletion-but-file-alread","errorCode":null,"errorMessage":"requested to mark for no deletion, but file already exists; this should not happen; investigate","messagePattern":"requested to mark for no deletion, but file already exists; this should not happen; investigate","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/block.go","lineNumber":421,"sourceCode":"\t}\n\n\tif err := bkt.Upload(ctx, m, bytes.NewBuffer(noCompactMark)); err != nil {\n\t\treturn errors.Wrapf(err, \"upload file %s to bucket\", m)\n\t}\n\tmarkedForNoCompact.Inc()\n\tlevel.Info(logger).Log(\"msg\", \"block has been marked for no compaction\", \"block\", id)\n\treturn nil\n}\n\n// MarkForNoDownsample creates a file which marks block to be not downsampled.\nfunc MarkForNoDownsample(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID, reason metadata.NoDownsampleReason, details string, markedForNoDownsample prometheus.Counter) error {\n\tm := path.Join(id.String(), metadata.NoDownsampleMarkFilename)\n\tnoDownsampleMarkExists, err := bkt.Exists(ctx, m)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"check exists %s in bucket\", m)\n\t}\n\tif noDownsampleMarkExists {\n\t\tlevel.Warn(logger).Log(\"msg\", \"requested to mark for no deletion, but file already exists; this should not happen; investigate\", \"err\", errors.Errorf(\"file %s already exists in bucket\", m))\n\t\treturn nil\n\t}\n\tnoDownsampleMark, err := json.Marshal(metadata.NoDownsampleMark{\n\t\tID:      id,\n\t\tVersion: metadata.NoDownsampleMarkVersion1,\n\n\t\tNoDownsampleTime: time.Now().Unix(),\n\t\tReason:           reason,\n\t\tDetails:          details,\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"json encode no downsample mark\")\n\t}\n\n\tif err := bkt.Upload(ctx, m, bytes.NewBuffer(noDownsampleMark)); err != nil {\n\t\treturn errors.Wrapf(err, \"upload file %s to bucket\", m)\n\t}\n\tmarkedForNoDownsample.Inc()","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/block.go#L403-L439","documentation":"A warn-level log guard in MarkForNoDownsample: a no-downsample mark file already exists for this block in the bucket, so the requested (re-)marking is skipped as already done. It is flagged as 'should not happen' because callers are expected to check the mark before requesting it; the underlying sentinel error naming the existing file is attached as err.","triggerScenarios":"Thrown at pkg/block/block.go:421 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify why the block is marked twice","No action needed — the mark is already present","Check compactor/downsample logic for repeated marking"],"exampleFix":null,"handlingStrategy":"type-guard","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"}