{"record":{"id":"b90a61597668681c","repo":"thanos-io/thanos","slug":"unexpected-no-compact-mark-file-version-d-expect","errorCode":null,"errorMessage":"unexpected no-compact-mark file version %d, expected %d","messagePattern":"unexpected no-compact-mark file version (.+?), expected (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/metadata/markers.go","lineNumber":141,"sourceCode":"\t\tif bkt.IsObjNotFoundErr(err) {\n\t\t\treturn ErrorMarkerNotFound\n\t\t}\n\t\treturn errors.Wrapf(err, \"get file: %s\", markerFile)\n\t}\n\tdefer runutil.CloseWithLogOnErr(logger, r, \"close bkt marker reader\")\n\n\tmetaContent, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"read file: %s\", markerFile)\n\t}\n\n\tif err := json.Unmarshal(metaContent, marker); err != nil {\n\t\treturn errors.Wrapf(ErrorUnmarshalMarker, \"file: %s; err: %v\", markerFile, err.Error())\n\t}\n\tswitch marker.markerFilename() {\n\tcase NoCompactMarkFilename:\n\t\tif version := marker.(*NoCompactMark).Version; version != NoCompactMarkVersion1 {\n\t\t\treturn errors.Errorf(\"unexpected no-compact-mark file version %d, expected %d\", version, NoCompactMarkVersion1)\n\t\t}\n\tcase NoDownsampleMarkFilename:\n\t\tif version := marker.(*NoDownsampleMark).Version; version != NoDownsampleMarkVersion1 {\n\t\t\treturn errors.Errorf(\"unexpected no-downsample-mark file version %d, expected %d\", version, NoDownsampleMarkVersion1)\n\t\t}\n\tcase DeletionMarkFilename:\n\t\tif version := marker.(*DeletionMark).Version; version != DeletionMarkVersion1 {\n\t\t\treturn errors.Errorf(\"unexpected deletion-mark file version %d, expected %d\", version, DeletionMarkVersion1)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":123,"sourceCodeEnd":154,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/metadata/markers.go#L123-L154","documentation":"After unmarshaling a no-compact-mark file, ReadMarker verifies that the Version field equals NoCompactMarkVersion1. This error is raised when the marker file exists and parses, but its version number is not the supported version 1, meaning the marker was written by a different (newer or older) format than this binary understands.","triggerScenarios":"Calling ReadMarker on a no-compact-mark file whose JSON contains a Version field with a value other than NoCompactMarkVersion1 — e.g. a file written by a newer M3DB release with version 2, or a hand-edited file with version 0 or a garbage value.","commonSituations":"Rolling upgrade/downgrade: a marker written by a newer node is read by an older binary; an operator manually edited the version field; a malformed writer bug emitted version 0.","solutions":["Check the Version field in the no-compact-mark file and confirm which M3DB version wrote it.","Upgrade (or align) the binary reading the marker to the version that wrote it so the formats match.","If the marker is stale/safe to drop, remove the no-compact-mark file and let compaction resume; re-create it with the current tooling if needed.","Verify cluster-wide that all nodes run a version supporting the same marker version (version 1)."],"exampleFix":"// before: old binary reading a newer marker fails\n// no-compact-mark contains {\"Version\": 2}\n\n// after: upgrade binary, or rewrite the marker with supported version\ndeleteNoCompactMark(namespace, blockID)\nWriteMarker(nsMd, blockID, &NoCompactMark{Version: NoCompactMarkVersion1})","handlingStrategy":"validation","validationCode":"var m struct{ Version int `json:\"version\"` }\nif json.Unmarshal(data, &m) == nil && m.Version != metadata.NoCompactMarkVersion1 {\n    // reject/invalidate the marker before calling ReadMarker\n}","typeGuard":"func isKnownNoCompactVersion(v int) bool { return v == metadata.NoCompactMarkVersion1 }","tryCatchPattern":"if err := metadata.ReadMarker(path, marker); err != nil {\n    if strings.Contains(err.Error(), \"unexpected no-compact-mark file version\") {\n        // version skew: stop, align binary versions, do not auto-delete\n        return fmt.Errorf(\"marker version skew: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep all cluster nodes on the same M3DB version before performing placement/namespace operations.","Never manually edit the Version field of marker files.","Check release notes for marker-format changes before upgrades/downgrades.","After restoring snapshots, verify marker versions match the running binary."],"tags":["versioning","metadata","compatibility","m3db"],"backgroundTag":"invalid-enum-value","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"}