argoproj/argo-workflows · error

missing counter.value

Error message

missing counter.value

What it means

ValidateMetricValues requires every Prometheus metric declaration of type gauge to supply a non-empty gauge.value expression. This validation guard fires during template validation (via validateTemplate) when a workflow spec declares a gauge metric but omits the value field, leaving nothing for the controller to record.

Source

Thrown at workflow/metrics/util.go:35

func IsValidMetricName(name string) bool {
	// Use promtheus's metric name checker, despite perhaps not using prometheus
	return model.LegacyValidation.IsValidMetricName(string(model.LabelValue(name))) && !strings.Contains(name, `:`)
}

func ValidateMetricValues(metric *wfv1.Prometheus) error {
	if metric.Gauge != nil {
		if metric.Gauge.Value == "" {
			return errors.New("missing gauge.value")
		}
		if metric.Gauge.Realtime != nil && *metric.Gauge.Realtime {
			if strings.Contains(metric.Gauge.Value, "resourcesDuration.") {
				return errors.New("'resourcesDuration.*' metrics cannot be used in real-time")
			}
		}
	}
	if metric.Counter != nil && metric.Counter.Value == "" {
		return errors.New("missing counter.value")
	}
	if metric.Histogram != nil && metric.Histogram.Value == "" {
		return errors.New("missing histogram.value")
	}
	return nil
}

func ValidateMetricLabels(metrics map[string]string) error {
	for name := range metrics {
		if !IsValidMetricName(name) {
			return fmt.Errorf(invalidMetricLabelError, name)
		}
	}
	return nil
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Set counter.value to an expression such as '1' or a template tag
  2. Remove the counter block if not intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at workflow/metrics/util.go:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/ce08582c514a3d3a. Report an issue: GitHub.