{"record":{"id":"33076e7813befdcb","repo":"thanos-io/thanos","slug":"unknown-alertstate-v","errorCode":null,"errorMessage":"unknown alertState: %v","messagePattern":"unknown alertState: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rules/rulespb/custom.go","lineNumber":284,"sourceCode":"\t\tr.Rules = make([]*Rule, 0)\n\t}\n\ttype plain RuleGroup\n\treturn json.Marshal((*plain)(r))\n}\n\nfunc (x *AlertState) UnmarshalJSON(entry []byte) error {\n\tfieldStr, err := strconv.Unquote(string(entry))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"alertState: unquote %v\", string(entry))\n\t}\n\n\tif fieldStr == \"\" {\n\t\treturn errors.New(\"empty alertState\")\n\t}\n\n\tstate, ok := AlertState_value[strings.ToUpper(fieldStr)]\n\tif !ok {\n\t\treturn errors.Errorf(\"unknown alertState: %v\", string(entry))\n\t}\n\t*x = AlertState(state)\n\treturn nil\n}\n\nfunc (x *AlertState) MarshalJSON() ([]byte, error) {\n\treturn []byte(strconv.Quote(strings.ToLower(x.String()))), nil\n}\n\n// Compare compares alert state x and y and returns:\n//\n//\t< 0 if x < y  (alert state x is more critical than alert state y)\n//\t  0 if x == y\n//\t> 0 if x > y  (alert state x is less critical than alert state y)\n//\n// For sorting this makes sure that more \"critical\" alert states come first.\nfunc (x AlertState) Compare(y AlertState) int {\n\treturn int(y) - int(x)","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/rules/rulespb/custom.go#L266-L302","documentation":"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.","triggerScenarios":"Thrown at pkg/rules/rulespb/custom.go:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}