thanos-io/thanos · error
unknown alertState
Error message
unknown alertState: %v
What it means
Raised in AlertState.UnmarshalJSON when the quoted string decodes fine but does not match any name in AlertState_value (case-insensitively via strings.ToUpper). The JSON carries an alert state label unknown to this build — usually a version mismatch between producer and consumer.
Solutions
- Use only known AlertState names: inactive, pending, firing
- Align producer and consumer Thanos/Prometheus versions
- Check for typos or locale-specific casing in the state string
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/rules/rulespb/custom.go:284 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/33076e7813befdcb.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/rules/rulespb/custom.go:284
r.Rules = make([]*Rule, 0)
}
type plain RuleGroup
return json.Marshal((*plain)(r))
}
func (x *AlertState) UnmarshalJSON(entry []byte) error {
fieldStr, err := strconv.Unquote(string(entry))
if err != nil {
return errors.Wrapf(err, "alertState: unquote %v", string(entry))
}
if fieldStr == "" {
return errors.New("empty alertState")
}
state, ok := AlertState_value[strings.ToUpper(fieldStr)]
if !ok {
return errors.Errorf("unknown alertState: %v", string(entry))
}
*x = AlertState(state)
return nil
}
func (x *AlertState) MarshalJSON() ([]byte, error) {
return []byte(strconv.Quote(strings.ToLower(x.String()))), nil
}
// Compare compares alert state x and y and returns:
//
// < 0 if x < y (alert state x is more critical than alert state y)
// 0 if x == y
// > 0 if x > y (alert state x is less critical than alert state y)
//
// For sorting this makes sure that more "critical" alert states come first.
func (x AlertState) Compare(y AlertState) int {
return int(y) - int(x)View on GitHub (pinned to 35b8b99117)