{"record":{"id":"ce08582c514a3d3a","repo":"argoproj/argo-workflows","slug":"missing-counter-value","errorCode":null,"errorMessage":"missing counter.value","messagePattern":"missing counter\\.value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/metrics/util.go","lineNumber":35,"sourceCode":"\nfunc IsValidMetricName(name string) bool {\n\t// Use promtheus's metric name checker, despite perhaps not using prometheus\n\treturn model.LegacyValidation.IsValidMetricName(string(model.LabelValue(name))) && !strings.Contains(name, `:`)\n}\n\nfunc ValidateMetricValues(metric *wfv1.Prometheus) error {\n\tif metric.Gauge != nil {\n\t\tif metric.Gauge.Value == \"\" {\n\t\t\treturn errors.New(\"missing gauge.value\")\n\t\t}\n\t\tif metric.Gauge.Realtime != nil && *metric.Gauge.Realtime {\n\t\t\tif strings.Contains(metric.Gauge.Value, \"resourcesDuration.\") {\n\t\t\t\treturn errors.New(\"'resourcesDuration.*' metrics cannot be used in real-time\")\n\t\t\t}\n\t\t}\n\t}\n\tif metric.Counter != nil && metric.Counter.Value == \"\" {\n\t\treturn errors.New(\"missing counter.value\")\n\t}\n\tif metric.Histogram != nil && metric.Histogram.Value == \"\" {\n\t\treturn errors.New(\"missing histogram.value\")\n\t}\n\treturn nil\n}\n\nfunc ValidateMetricLabels(metrics map[string]string) error {\n\tfor name := range metrics {\n\t\tif !IsValidMetricName(name) {\n\t\t\treturn fmt.Errorf(invalidMetricLabelError, name)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":17,"sourceCodeEnd":51,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/metrics/util.go#L17-L51","documentation":"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.","triggerScenarios":"Thrown at workflow/metrics/util.go:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set counter.value to an expression such as '1' or a template tag","Remove the counter block if not intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}