VictoriaMetrics/VictoriaMetrics · error
missing `target_label` for `action=dropequal`
Error message
missing `target_label` for `action=dropequal`
What it means
Validation guard in parseRelabelConfig for action=dropequal: this action needs a destination label to compare against a source label, so target_label must be set. It fires when a dropequal relabeling rule is defined without target_label.
Source
Thrown at lib/promrelabel/config.go:340
if len(sourceLabels) < 2 {
return nil, fmt.Errorf("`source_labels` must contain at least two entries for `action=drop_if_equal`; got %q", sourceLabels)
}
if targetLabel != "" {
return nil, fmt.Errorf("`target_label` cannot be used for `action=drop_if_equal`")
}
if rc.Regex != nil {
return nil, fmt.Errorf("`regex` cannot be used for `action=drop_if_equal`")
}
case "keepequal":
if targetLabel == "" {
return nil, fmt.Errorf("missing `target_label` for `action=keepequal`")
}
if rc.Regex != nil {
return nil, fmt.Errorf("`regex` cannot be used for `action=keepequal`")
}
case "dropequal":
if targetLabel == "" {
return nil, fmt.Errorf("missing `target_label` for `action=dropequal`")
}
if rc.Regex != nil {
return nil, fmt.Errorf("`regex` cannot be used for `action=dropequal`")
}
case "keep":
if len(sourceLabels) == 0 && rc.If == nil {
return nil, fmt.Errorf("missing `source_labels` for `action=keep`")
}
case "drop":
if len(sourceLabels) == 0 && rc.If == nil {
return nil, fmt.Errorf("missing `source_labels` for `action=drop`")
}
case "hashmod":
if len(sourceLabels) == 0 {
return nil, fmt.Errorf("missing `source_labels` for `action=hashmod`")
}
if targetLabel == "" {
return nil, fmt.Errorf("missing `target_label` for `action=hashmod`")View on GitHub (pinned to 5079fb58f1)
Solutions
- Add `target_label: <label_name>` to the relabeling rule
- If comparison against the metric name was intended, use `action=drop_if_equal` instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/promrelabel/config.go:340 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/fdfa3b641e380b33.
Report an issue: GitHub.