argoproj/argo-workflows · error

Metrics registerCallback() to invalid type %s (%t)

Error message

Metrics registerCallback() to invalid type %s (%t)

What it means

RegisterCallback hit its default branch: the instrument being registered is not one of the supported observable otel instrument types, so the metric callback cannot be attached. Indicates an instrument-type mismatch in the metrics wiring code.

Source

Thrown at util/telemetry/operators.go:61

		(*inst).Record(ctx, val, i.attributes(ctx, attribs))
	default:
		logging.RequireLoggerFromContext(ctx).WithField("name", i.name).WithField("type", i.otel).Error(ctx, "Metrics record() to invalid type")
	}
}

func (i *Instrument) RegisterCallback(m *Metrics, f metric.Callback) error {
	switch inst := i.otel.(type) {
	case *metric.Float64ObservableCounter:
		_, err := (*m.otelMeter).RegisterCallback(f, *inst)
		return err
	case *metric.Float64ObservableGauge:
		_, err := (*m.otelMeter).RegisterCallback(f, *inst)
		return err
	case *metric.Int64ObservableGauge:
		_, err := (*m.otelMeter).RegisterCallback(f, *inst)
		return err
	default:
		return fmt.Errorf("Metrics registerCallback() to invalid type %s (%t)", i.name, i.otel)
	}
}

func (i *Instrument) ObserveInt(ctx context.Context, o metric.Observer, val int64, attribs Attributes) {
	switch inst := i.otel.(type) {
	case *metric.Int64ObservableGauge:
		o.ObserveInt64(*inst, val, i.attributes(ctx, attribs))
	default:
		logging.RequireLoggerFromContext(ctx).WithFields(logging.Fields{
			"name": i.name,
			"type": i.otel,
		}).Error(ctx, "Metrics observeInt() to invalid type")
	}
}

func (i *Instrument) ObserveFloat(ctx context.Context, o metric.Observer, val float64, attribs Attributes) {
	switch inst := i.otel.(type) {
	case *metric.Float64ObservableGauge:

View on GitHub (pinned to 35bff19146)

Solutions

  1. Ensure the instrument was created as an observable counter/gauge/up-down-counter before registering callbacks
  2. Check for mixed argo-workflows versions in the process
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at util/telemetry/operators.go:61 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/a5f05285f9842fdd. Report an issue: GitHub.