argoproj/argo-workflows · error

missing gauge.value

Error message

missing gauge.value

What it means

Template validation guard: a Prometheus metric declared with metric.Gauge set has an empty gauge.value expression, so there is nothing to evaluate. Raised from validateTemplate when a template's metrics block is malformed.

Source

Thrown at workflow/metrics/util.go:26

	"github.com/prometheus/common/model"

	wfv1 "github.com/argoproj/argo-workflows/v4/pkg/apis/workflow/v1alpha1"
)

var (
	invalidMetricNameError  = "metric name is invalid: names may only contain alphanumeric characters or '_'"
	invalidMetricLabelError = "metric label '%s' is invalid: keys may only contain alphanumeric characters or '_'"
)

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 {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Set gauge.value to an expression, e.g. gauge: value: '{{workflow.duration}}'
  2. Remove the gauge block if no gauge metric is intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at workflow/metrics/util.go:26 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/c75e1a1c8ad39028. Report an issue: GitHub.