{"record":{"id":"2914ad1d23f3a15b","repo":"grpc/grpc-go","slug":"error-parsing-outlier-detection-config-v-v","errorCode":null,"errorMessage":"error parsing Outlier Detection config %v: %v","messagePattern":"error parsing Outlier Detection config (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/cdsbalancer.go","lineNumber":357,"sourceCode":"\t\treturn fmt.Errorf(\"%q LB policy is needed but not registered\", outlierdetection.Name)\n\t}\n\n\todParser, ok := odBuilder.(balancer.ConfigParser)\n\tif !ok {\n\t\t// Shouldn't happen, imported Outlier Detection builder has this method.\n\t\treturn fmt.Errorf(\"%q LB policy does not implement a config parser\", outlierdetection.Name)\n\t}\n\n\tfor _, p := range b.priorities {\n\t\t// Update Outlier Detection Config.\n\t\todJSON := p.clusterConfig.Cluster.OutlierDetection\n\t\tif odJSON == nil {\n\t\t\todJSON = json.RawMessage(`{}`)\n\t\t}\n\n\t\tlbCfg, err := odParser.ParseConfig(odJSON)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing Outlier Detection config %v: %v\", odJSON, err)\n\t\t}\n\n\t\todCfg, ok := lbCfg.(*outlierdetection.LBConfig)\n\t\tif !ok {\n\t\t\t// Shouldn't happen, Parser built at build time with Outlier\n\t\t\t// Detection builder pulled from gRPC LB Registry.\n\t\t\treturn fmt.Errorf(\"config parser for Outlier Detection returned config with unexpected type %T: %v\", lbCfg, lbCfg)\n\t\t}\n\t\tp.outlierDetection = *odCfg\n\t}\n\treturn nil\n}\n\n// ResolverError handles errors reported by the xdsResolver.\nfunc (b *cdsBalancer) ResolverError(err error) {\n\t// Missing Listener or RouteConfiguration on the management server\n\t// results in a 'resource not found' error from the xDS resolver. In\n\t// these cases, we should report transient failure.","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/balancer/cdsbalancer/cdsbalancer.go#L339-L375","documentation":"Returned by updateOutlierDetection (line 357) when odParser.ParseConfig(odJSON) fails on the outlier detection JSON from the cluster resource. The %v values are: first the raw odJSON (json.RawMessage), second the parse error. If the cluster has no outlier detection config, odJSON defaults to '{}' (line 352) which should always parse successfully — so a failure indicates non-empty, invalid OD config.","triggerScenarios":"The CDS cluster resource contains an outlier detection configuration (envoy.config.cluster.v3.OutlierDetection) whose JSON representation the outlier detection balancer's ParseConfig rejects. This fires for each priority in b.priorities (line 348 loop).","commonSituations":"The management server sends outlier detection fields with invalid values (e.g., interval of 0, negative success rate threshold, enforcement_success_rate_minimum_hosts exceeding limits). Version skew where the server sends newer OD fields the client doesn't recognize or rejects. A control plane bug generating malformed OD JSON.","solutions":["Inspect the full error which includes the raw OD JSON (%v) to see which fields are present.","Validate the outlier detection parameters in the management server config: intervals must be positive durations, thresholds in [0,100], multipliers >= 1.","Check for version compatibility — update the client or server so both agree on the OD schema.","If outlier detection is not needed, remove it from the cluster resource on the management server side."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate outlier detection config JSON before it reaches the balancer\n// (useful if you generate or proxy xDS resources):\nfunc validateODConfig(raw json.RawMessage) error {\n    var cfg struct {\n        Interval           *json.RawMessage `json:\"interval\"`\n        Enforcing          *uint32          `json:\"enforcing_success_rate\"`\n        SuccessRateMinimum *uint32          `json:\"success_rate_minimum_hosts\"`\n    }\n    if err := json.Unmarshal(raw, &cfg); err != nil {\n        return fmt.Errorf(\"invalid OD JSON: %w\", err)\n    }\n    if cfg.Enforcing != nil && *cfg.Enforcing > 100 {\n        return fmt.Errorf(\"enforcing_success_rate must be <= 100\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Unwrap the error to inspect the raw OD JSON that failed:\nerr := getChannelError(conn)\nif strings.Contains(err.Error(), \"error parsing Outlier Detection\") {\n    // the %v in the message includes the raw JSON — inspect it\n    // validate field values against the gRFC spec\n}","preventionTips":["Validate outlier detection field ranges on the management server side.","Keep client and control plane versions aligned for OD schema compatibility.","Use xDS debug logging to capture the raw OD config for inspection."],"tags":["xds","outlier-detection","json","parse","config"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}