{"record":{"id":"f82b447b6c272d9a","repo":"thanos-io/thanos","slug":"unmarshal-marker-json","errorCode":null,"errorMessage":"unmarshal marker JSON","messagePattern":"unmarshal marker JSON","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/block/metadata/markers.go","lineNumber":44,"sourceCode":"\tNoCompactMarkFilename = \"no-compact-mark.json\"\n\t// NoDownsampleMarkFilename is the known json filenanme for optional file storing details about why block has to be excluded from downsampling.\n\t// If such file is present in block dir, it means the block has to be excluded from downsampling.\n\tNoDownsampleMarkFilename = \"no-downsample-mark.json\"\n\t// DeletionMarkVersion1 is the version of deletion-mark file supported by Thanos.\n\tDeletionMarkVersion1 = 1\n\t// NoCompactMarkVersion1 is the version of no-compact-mark file supported by Thanos.\n\tNoCompactMarkVersion1 = 1\n\t// NoDownsampleVersion1 is the version of no-downsample-mark file supported by Thanos.\n\tNoDownsampleMarkVersion1 = 1\n)\n\nvar (\n\t// ErrorMarkerNotFound is the error when marker file is not found.\n\tErrorMarkerNotFound = errors.New(\"marker not found\")\n\t// ErrorUnmarshalMarker is the error when unmarshalling marker JSON file.\n\t// This error can occur because marker has been partially uploaded to block storage\n\t// or the marker file is not a valid json file.\n\tErrorUnmarshalMarker = errors.New(\"unmarshal marker JSON\")\n)\n\ntype Marker interface {\n\tmarkerFilename() string\n}\n\n// DeletionMark stores block id and when block was marked for deletion.\ntype DeletionMark struct {\n\t// ID of the tsdb block.\n\tID ulid.ULID `json:\"id\"`\n\t// Version of the file.\n\tVersion int `json:\"version\"`\n\t// Details is a human readable string giving details of reason.\n\tDetails string `json:\"details,omitempty\"`\n\n\t// DeletionTime is a unix timestamp of when the block was marked to be deleted.\n\tDeletionTime int64 `json:\"deletion_time\"`\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/metadata/markers.go#L26-L62","documentation":"ErrorUnmarshalMarker is the sentinel error returned by metadata.ReadMarker when the marker JSON file exists but cannot be unmarshalled into the requested marker struct. Per its doc comment, this typically happens because the marker was only partially uploaded to the object storage, or the file is not valid JSON.","triggerScenarios":"ReadMarker reads deletion-mark.json (or another marker) whose bytes are truncated/corrupt — e.g. an interrupted or partially-uploaded marker file — so json.Unmarshal fails and ReadMarker wraps this sentinel with the file name and underlying message.","commonSituations":"Object storage multipart uploads interrupted mid-write; lifecycle/proxy mangling marker content; manually edited marker files; network truncation when downloading the marker.","solutions":["Treat as a transient/corruption signal and skip the block, as the fetcher does (with a warning); re-attempt later.","If it recurs for the same block, delete and re-upload the marker file in the object storage.","Inspect the marker file content in the bucket to confirm whether it is truncated or invalid JSON, and rewrite it."],"exampleFix":"// before\nif err := metadata.ReadMarker(ctx, logger, bkt, id.String(), m); err != nil {\n\treturn err\n}\n// after\nif err := metadata.ReadMarker(ctx, logger, bkt, id.String(), m); err != nil {\n\tif errors.Cause(err) == metadata.ErrorUnmarshalMarker {\n\t\tlevel.Warn(logger).Log(\"msg\", \"partial marker file\", \"block\", id, \"err\", err)\n\t\tcontinue\n\t}\n\treturn err\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if errors.Cause(err) == metadata.ErrorUnmarshalMarker {\n\tlevel.Warn(logger).Log(\"msg\", \"partial marker file; retry later or delete it\", \"block\", id, \"err\", err)\n\treturn nil // or retry with backoff\n}","preventionTips":["Use atomic uploads (upload to temp key then copy/rename) when writing marker files.","Monitor repeated unmarshal failures for the same block — it signals a permanently corrupt marker to delete.","Avoid manually editing marker JSON in the bucket; regenerate it with tooling that validates JSON."],"tags":["json","unmarshal","marker-file","partial-upload","object-storage"],"backgroundTag":"json-unmarshal-failed","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"}