{"record":{"id":"5ed42d6e4b516898","repo":"thanos-io/thanos","slug":"unsupported-relabel-action-v","errorCode":null,"errorMessage":"unsupported relabel action: %v","messagePattern":"unsupported relabel action: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/fetcher.go","lineNumber":1413,"sourceCode":")\n\n// ParseRelabelConfig parses relabel configuration.\n// If supportedActions not specified, all relabel actions are valid.\nfunc ParseRelabelConfig(contentYaml []byte, supportedActions map[relabel.Action]struct{}) ([]*relabel.Config, error) {\n\tvar relabelConfig []*relabel.Config\n\tif err := yaml.Unmarshal(contentYaml, &relabelConfig); err != nil {\n\t\treturn nil, errors.Wrap(err, \"parsing relabel configuration\")\n\t}\n\tfor _, cfg := range relabelConfig {\n\t\tif err := cfg.Validate(prommodel.UTF8Validation); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"validate relabel config\")\n\t\t}\n\t}\n\n\tif supportedActions != nil {\n\t\tfor _, cfg := range relabelConfig {\n\t\t\tif _, ok := supportedActions[cfg.Action]; !ok {\n\t\t\t\treturn nil, errors.Errorf(\"unsupported relabel action: %v\", cfg.Action)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn relabelConfig, nil\n}\n","sourceCodeStart":1395,"sourceCodeEnd":1420,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/fetcher.go#L1395-L1420","documentation":"ParseRelabelConfig optionally restricts relabel actions: when supportedActions is non-nil, any rule whose cfg.Action is not in that set causes errors.Errorf(\"unsupported relabel action: %v\"). Callers use it to whitelist only the actions meaningful for a given subsystem (e.g. bucket verification only allows a subset).","triggerScenarios":"Calling ParseRelabelConfig with supportedActions set (e.g. via APIs that accept only specific actions) while the YAML file contains a rule with an action outside that set — such as 'labelmap', 'hashmod', or 'lowercase' where only keep/drop/replace are allowed.","commonSituations":"Reusing a general-purpose relabel file (from Prometheus scrape config) in a Thanos context that whitelists actions; typos in action names ('kept', 'Drop' with wrong case); using newer Prometheus actions on an older Thanos build that doesn't know them.","solutions":["Remove or replace the offending rule's action with one in the supported set for that call site.","Check the supportedActions map at the call site (e.g. pkg/block/fetcher.go usages like ParsedActions for bucket verification) to see which actions are allowed.","Fix typos/casing — actions are lowercase enum values (keep, drop, replace, keep, labeldrop, labelmap, hashmod, uppercase, lowercase).","Upgrade Thanos if the action is a newer Prometheus relabel action not yet in the allow-list."],"exampleFix":"// before\n// - action: labelmap\n//   regex: probe_(.*)\n// after (if only keep/drop supported)\n// - action: keep\n//   source_labels: [probe]\n//   regex: \"true\"","handlingStrategy":"validation","validationCode":"// Go: check actions against the allow-list before calling ParseRelabelConfig\nfor _, c := range cfgs {\n    if _, ok := supportedActions[c.Action]; !ok {\n        return fmt.Errorf(\"action %q not allowed here\", c.Action)\n    }\n}","typeGuard":null,"tryCatchPattern":"cfgs, err := block.ParseRelabelConfig(contentYaml, supportedActions)\nif err != nil && strings.Contains(err.Error(), \"unsupported relabel action\") {\n    return fmt.Errorf(\"check allowed actions for this subsystem: %w\", err)\n}","preventionTips":["Know which actions the call site whitelists and keep dedicated config files per subsystem.","Use exact lowercase action names (keep, drop, replace, labelmap, labeldrop, hashmod, uppercase, lowercase).","Do not copy scrape-config relabel rules verbatim into bucket/tool configs.","Verify action support against the Thanos/Prometheus version you deploy."],"tags":["relabel","configuration","validation","thanos"],"backgroundTag":"unsupported-enum-value","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"}