thanos-io/thanos · error

unexpected no-downsample-mark file version

Error message

unexpected no-downsample-mark file version %d, expected %d

What it means

ReadMarker checks that a no-downsample-mark file's Version field equals NoDownsampleMarkVersion1. This error is raised when the marker file parses as JSON but carries an unsupported version number, so the binary refuses to interpret a marker written in a different format.

Solutions

  1. Read the Version field from the no-downsample-mark file and identify the writing M3DB version.
  2. Upgrade the reading node to a binary that supports the marker version found in the file.
  3. If downsampling can safely proceed, delete the stale marker and re-create it with version 1 via the current tooling.
  4. Ensure all nodes in the cluster run compatible versions before performing namespace/downsampling operations.

Example fix

// before: marker written with Version 3, reader expects 1 -> error

// after: remove stale marker and rewrite with supported version
os.Remove(noDownsampleMarkPath)
WriteMarker(nsMd, blockID, &NoDownsampleMark{Version: NoDownsampleMarkVersion1})
Defensive patterns

Strategy: validation

Validate before calling

var m struct{ Version int `json:"version"` }
if json.Unmarshal(data, &m) == nil && m.Version != metadata.NoDownsampleMarkVersion1 {
    // unsupported marker version: handle before ReadMarker
}

Type guard

func isKnownNoDownsampleVersion(v int) bool { return v == metadata.NoDownsampleMarkVersion1 }

Try / catch

if err := metadata.ReadMarker(path, marker); err != nil {
    if strings.Contains(err.Error(), "unexpected no-downsample-mark file version") {
        return fmt.Errorf("no-downsample-mark version skew: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling ReadMarker on a no-downsample-mark file whose decoded Version differs from NoDownsampleMarkVersion1 — typically a marker written by a newer M3DB release or a manually edited/hand-crafted marker file.

Common situations: Mixed-version cluster during rolling upgrades; downgrade of a node that already wrote a future-version marker; operator tampering with namespace metadata files; corrupted version field from bad disk writes.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/e34b1ee598f3207c. Report an issue: GitHub.

Appendix: source

Thrown at pkg/block/metadata/markers.go:145

	}
	defer runutil.CloseWithLogOnErr(logger, r, "close bkt marker reader")

	metaContent, err := io.ReadAll(r)
	if err != nil {
		return errors.Wrapf(err, "read file: %s", markerFile)
	}

	if err := json.Unmarshal(metaContent, marker); err != nil {
		return errors.Wrapf(ErrorUnmarshalMarker, "file: %s; err: %v", markerFile, err.Error())
	}
	switch marker.markerFilename() {
	case NoCompactMarkFilename:
		if version := marker.(*NoCompactMark).Version; version != NoCompactMarkVersion1 {
			return errors.Errorf("unexpected no-compact-mark file version %d, expected %d", version, NoCompactMarkVersion1)
		}
	case NoDownsampleMarkFilename:
		if version := marker.(*NoDownsampleMark).Version; version != NoDownsampleMarkVersion1 {
			return errors.Errorf("unexpected no-downsample-mark file version %d, expected %d", version, NoDownsampleMarkVersion1)
		}
	case DeletionMarkFilename:
		if version := marker.(*DeletionMark).Version; version != DeletionMarkVersion1 {
			return errors.Errorf("unexpected deletion-mark file version %d, expected %d", version, DeletionMarkVersion1)
		}
	}
	return nil
}

View on GitHub (pinned to 35b8b99117)