thanos-io/thanos · error

unsupported relabel action

Error message

unsupported relabel action: %v

What it means

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).

Solutions

  1. Remove or replace the offending rule's action with one in the supported set for that call site.
  2. 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.
  3. Fix typos/casing — actions are lowercase enum values (keep, drop, replace, keep, labeldrop, labelmap, hashmod, uppercase, lowercase).
  4. Upgrade Thanos if the action is a newer Prometheus relabel action not yet in the allow-list.

Example fix

// before
// - action: labelmap
//   regex: probe_(.*)
// after (if only keep/drop supported)
// - action: keep
//   source_labels: [probe]
//   regex: "true"
Defensive patterns

Strategy: validation

Validate before calling

// Go: check actions against the allow-list before calling ParseRelabelConfig
for _, c := range cfgs {
    if _, ok := supportedActions[c.Action]; !ok {
        return fmt.Errorf("action %q not allowed here", c.Action)
    }
}

Try / catch

cfgs, err := block.ParseRelabelConfig(contentYaml, supportedActions)
if err != nil && strings.Contains(err.Error(), "unsupported relabel action") {
    return fmt.Errorf("check allowed actions for this subsystem: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/5ed42d6e4b516898. Report an issue: GitHub.

Appendix: source

Thrown at pkg/block/fetcher.go:1413

)

// ParseRelabelConfig parses relabel configuration.
// If supportedActions not specified, all relabel actions are valid.
func ParseRelabelConfig(contentYaml []byte, supportedActions map[relabel.Action]struct{}) ([]*relabel.Config, error) {
	var relabelConfig []*relabel.Config
	if err := yaml.Unmarshal(contentYaml, &relabelConfig); err != nil {
		return nil, errors.Wrap(err, "parsing relabel configuration")
	}
	for _, cfg := range relabelConfig {
		if err := cfg.Validate(prommodel.UTF8Validation); err != nil {
			return nil, errors.Wrap(err, "validate relabel config")
		}
	}

	if supportedActions != nil {
		for _, cfg := range relabelConfig {
			if _, ok := supportedActions[cfg.Action]; !ok {
				return nil, errors.Errorf("unsupported relabel action: %v", cfg.Action)
			}
		}
	}

	return relabelConfig, nil
}

View on GitHub (pinned to 35b8b99117)