thanos-io/thanos · error
json encode no downsample mark
Error message
json encode no downsample mark
What it means
Wraps json.Marshal while serializing the NoDownsampleMark structure (block ULID, version, reason, details, timestamp) before uploading it to the bucket. Marshal of this fixed shape can only fail if a field cannot be represented — in practice an internal invariant break rather than user input.
Solutions
- Inspect metadata.NoDownsampleMark fields for serialization issues
- Report with wrapped cause if reproducible
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/block/block.go:433 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/117855ab630864d1.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/block/block.go:433
m := path.Join(id.String(), metadata.NoDownsampleMarkFilename)
noDownsampleMarkExists, err := bkt.Exists(ctx, m)
if err != nil {
return errors.Wrapf(err, "check exists %s in bucket", m)
}
if noDownsampleMarkExists {
level.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))
return nil
}
noDownsampleMark, err := json.Marshal(metadata.NoDownsampleMark{
ID: id,
Version: metadata.NoDownsampleMarkVersion1,
NoDownsampleTime: time.Now().Unix(),
Reason: reason,
Details: details,
})
if err != nil {
return errors.Wrap(err, "json encode no downsample mark")
}
if err := bkt.Upload(ctx, m, bytes.NewBuffer(noDownsampleMark)); err != nil {
return errors.Wrapf(err, "upload file %s to bucket", m)
}
markedForNoDownsample.Inc()
level.Info(logger).Log("msg", "block has been marked for no downsample", "block", id)
return nil
}
// RemoveMark removes the file which marked the block for deletion, no-downsample or no-compact.
func RemoveMark(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID, removeMark prometheus.Counter, markedFilename string) error {
markedFile := path.Join(id.String(), markedFilename)
markedFileExists, err := bkt.Exists(ctx, markedFile)
if err != nil {
return errors.Wrapf(err, "check if %s file exists in bucket", markedFile)
}
if !markedFileExists {View on GitHub (pinned to 35b8b99117)