{"record":{"id":"018921da52b16303","repo":"thanos-io/thanos","slug":"json-encode-no-compact-mark","errorCode":null,"errorMessage":"json encode no compact mark","messagePattern":"json encode no compact mark","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/block.go","lineNumber":402,"sourceCode":"\tnoCompactMarkExists, 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 noCompactMarkExists {\n\t\tlevel.Warn(logger).Log(\"msg\", \"requested to mark for no compaction, 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\n\tnoCompactMark, err := json.Marshal(metadata.NoCompactMark{\n\t\tID:      id,\n\t\tVersion: metadata.NoCompactMarkVersion1,\n\n\t\tNoCompactTime: 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 compact mark\")\n\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 {","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/block.go#L384-L420","documentation":"MarkForNoCompact failed to JSON-encode the NoCompactMark struct before upload. This is a serialization failure of an internally constructed struct, indicating a programming/field error rather than user input, and the block remains unmarked.","triggerScenarios":"Thrown at pkg/block/block.go:402 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check metadata.NoCompactMark struct fields for unsupported types","This is an internal error; report with the wrapped cause if reproducible"],"exampleFix":null,"handlingStrategy":"try-catch","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"}