thanos-io/thanos · error

unknown match type

Error message

unknown match type

What it means

A guard panic in LabelMatcher_Type.PromString: the matcher type enum value is not one of EQ/NEQ/RE/NRE, so no '='/'!='/'=~'/'!~' operator string exists. Only reachable with an out-of-range enum value (corrupted proto or incompatible version), as the proto enum cannot normally hold another value.

Solutions

  1. Validate matcher type range before rendering to string
  2. Check for corrupted or version-mismatched storepb data feeding PromString
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/store/storepb/custom.go:476 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/8a0352faa83e5486. Report an issue: GitHub.

Appendix: source

Thrown at pkg/store/storepb/custom.go:476

func (m *LabelMatcher) GetName() string {
	return m.Name
}

func (m *LabelMatcher) GetValue() string {
	return m.Value
}

func (x LabelMatcher_Type) PromString() string {
	typeToStr := map[LabelMatcher_Type]string{
		LabelMatcher_EQ:  "=",
		LabelMatcher_NEQ: "!=",
		LabelMatcher_RE:  "=~",
		LabelMatcher_NRE: "!~",
	}
	if str, ok := typeToStr[x]; ok {
		return str
	}
	panic("unknown match type")
}

// PromLabels return Prometheus labels.Labels without extra allocation.
func (m *Series) PromLabels() labels.Labels {
	return labelpb.ZLabelsToPromLabels(m.Labels)
}

// Deprecated.
// TODO(bwplotka): Remove this once Cortex dep will stop using it.
type Label = labelpb.ZLabel

// Deprecated.
// TODO(bwplotka): Remove this in next PR. Done to reduce diff only.
type LabelSet = labelpb.ZLabelSet

// Deprecated.
// TODO(bwplotka): Remove this once Cortex dep will stop using it.
func CompareLabels(a, b []Label) int {

View on GitHub (pinned to 35b8b99117)