thanos-io/thanos · error
validate relabel config
Error message
validate relabel config
What it means
LoadRelabelConfigs strictly unmarshals the relabel_configs YAML into []*relabel.Config and then calls Validate(model.UTF8Validation) on each; any relabel rule failing Prometheus relabel validation (bad regex, unknown action, missing fields) is wrapped with 'validate relabel config'.
Solutions
- Read the wrapped underlying error to see which relabel config and field failed; fix the regex/action/field in that rule.
- Validate the relabel YAML locally with a Prometheus relabel.Config strict unmarshal before deploying.
- Cross-check actions against relabel.Config supported actions for this Prometheus version.
Example fix
// before
- action: regex
regex: '.*('
// after
- action: drop
regex: '.*debug.*' Defensive patterns
Strategy: validation
Validate before calling
var cfgs []*relabel.Config
if err := yaml.UnmarshalStrict(relabelYaml, &cfgs); err != nil { return err }
for _, c := range cfgs {
if err := c.Validate(model.UTF8Validation); err != nil {
return fmt.Errorf("relabel config invalid: %w", err)
}
} Prevention
- Pre-validate relabel YAML with the same relabel.Config Validate call before deploy
- Use only documented relabel actions for the pinned Prometheus version
- Test regexes with the RE2 engine (e.g. via promtool) before committing
When it happens
Trigger: runRule loads alerting relabel configs; a rule has an invalid regex (bad RE2 pattern), an unsupported action name, a missing required field (e.g. source_labels/target_label), or duplicate labels in invalid UTF-8.
Common situations: Typo in action: keep/match instead of keep/match; invalid regex like '.*(' for the drop action; copying scrape relabel configs that use actions unsupported in this context.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- unsupported format for label
- --auto-gomemlimit.ratio must be greater than 0 and less…
- unable to unmarshal config content
- endpoint
- unable to validate endpoints
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/e857dad43b1134a6.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/alert/config.go:151
EndpointsConfig: clientconfig.HTTPEndpointsConfig{
PathPrefix: parsed.Path,
Scheme: scheme,
StaticAddresses: []string{host},
},
Timeout: model.Duration(timeout),
APIVersion: APIv2,
}, nil
}
// LoadRelabelConfigs loads a list of relabel.Config from YAML data.
func LoadRelabelConfigs(confYaml []byte) ([]*relabel.Config, error) {
var cfg []*relabel.Config
if err := yaml.UnmarshalStrict(confYaml, &cfg); err != nil {
return nil, err
}
for _, c := range cfg {
if err := c.Validate(model.UTF8Validation); err != nil {
return nil, errors.Wrap(err, "validate relabel config")
}
}
return cfg, nil
}
View on GitHub (pinned to 35b8b99117)