grpc/grpc-go · error

error parsing Outlier Detection config %v: %v

Error message

error parsing Outlier Detection config %v: %v

What it means

The CDS balancer parses the Outlier Detection JSON from each cluster resource using the outlier detection balancer's config parser. This error fires when that JSON fails to parse, including validation failures for negative durations, invalid ejection percentages, or malformed child config. The Outlier Detection JSON comes from the management server's cluster resource.

Source

Thrown at internal/xds/balancer/cdsbalancer/cdsbalancer.go:357

		return fmt.Errorf("%q LB policy is needed but not registered", outlierdetection.Name)
	}

	odParser, ok := odBuilder.(balancer.ConfigParser)
	if !ok {
		// Shouldn't happen, imported Outlier Detection builder has this method.
		return fmt.Errorf("%q LB policy does not implement a config parser", outlierdetection.Name)
	}

	for _, p := range b.priorities {
		// Update Outlier Detection Config.
		odJSON := p.clusterConfig.Cluster.OutlierDetection
		if odJSON == nil {
			odJSON = json.RawMessage(`{}`)
		}

		lbCfg, err := odParser.ParseConfig(odJSON)
		if err != nil {
			return fmt.Errorf("error parsing Outlier Detection config %v: %v", odJSON, err)
		}

		odCfg, ok := lbCfg.(*outlierdetection.LBConfig)
		if !ok {
			// Shouldn't happen, Parser built at build time with Outlier
			// Detection builder pulled from gRPC LB Registry.
			return fmt.Errorf("config parser for Outlier Detection returned config with unexpected type %T: %v", lbCfg, lbCfg)
		}
		p.outlierDetection = *odCfg
	}
	return nil
}

// ResolverError handles errors reported by the xdsResolver.
func (b *cdsBalancer) ResolverError(err error) {
	// Missing Listener or RouteConfiguration on the management server
	// results in a 'resource not found' error from the xDS resolver. In
	// these cases, we should report transient failure.

View on GitHub (pinned to 03255a9237)

Solutions

  1. Inspect the raw Outlier Detection JSON from the management server for the failing cluster (enable xDS logging)
  2. Verify all duration fields (interval, base_ejection_time, max_ejection_time) are non-negative
  3. Verify max_ejection_percent is between 0 and 100
  4. Check that SRE and FPE sub-configs (if present) have valid numeric thresholds
  5. Disable outlier detection for the cluster on the management server if the config cannot be fixed immediately

Example fix

// before: negative interval in outlier detection config
{"interval": "-5s", "baseEjectionTime": "30s"}
// after: non-negative durations
{"interval": "10s", "baseEjectionTime": "30s"}
Defensive patterns

Strategy: validation

Validate before calling

// Validate outlier detection JSON before relying on it
func validateOutlierDetectionJSON(raw json.RawMessage) error {
    var cfg struct {
        Interval           *string  `json:"interval"`
        BaseEjectionTime   *string  `json:"baseEjectionTime"`
        MaxEjectionTime    *string  `json:"maxEjectionTime"`
        MaxEjectionPercent *float64 `json:"maxEjectionPercent"`
    }
    if err := json.Unmarshal(raw, &cfg); err != nil {
        return err
    }
    // Validate durations are non-negative and percent is 0-100
    return nil
}

Prevention

When it happens

Trigger: Triggered in updateOutlierDetection() when odParser.ParseConfig(odJSON) returns an error for one of the priorities. The odJSON bytes are the raw OutlierDetection field from the cluster resource; if nil, a default empty config {} is used. The parser validates interval, base_ejection_time, max_ejection_time (non-negative), max_ejection_percent (0-100), and child config validity.

Common situations: The management server sends outlier detection config with negative duration values, ejection percentages > 100, or missing required sub-config fields; a malformed protobuf-to-JSON conversion on the server side; the SRE (Success Rate Ejection) or FPE (Failure Percentage Ejection) sub-configs have invalid values.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/2914ad1d23f3a15b. Report an issue: GitHub.