{"record":{"id":"2a6d891ef9917475","repo":"grpc/grpc-go","slug":"config-parser-for-outlier-detection-returned-confi","errorCode":null,"errorMessage":"config parser for Outlier Detection returned config with unexpected type %T: %v","messagePattern":"config parser for Outlier Detection returned config with unexpected type %T: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/balancer/cdsbalancer/cdsbalancer.go","lineNumber":364,"sourceCode":"\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.\n\tif xdsresource.ErrType(err) == xdsresource.ErrorTypeResourceNotFound {\n\t\tb.closeChildPolicyAndReportTF(err)\n\t\treturn\n\t}\n\tvar root string\n\tif b.lbCfg != nil {\n\t\troot = b.lbCfg.ClusterName","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/balancer/cdsbalancer/cdsbalancer.go#L346-L382","documentation":"Returned by updateOutlierDetection (line 364) when the config returned by odParser.ParseConfig is not of type *outlierdetection.LBConfig (type assertion at line 360 fails). The %T shows the actual type and %v shows the value. The comment (lines 362-363) says this should never happen because the parser is obtained from the outlier detection builder at build time.","triggerScenarios":"The outlier detection builder's ParseConfig returns a config object whose concrete type is not *outlierdetection.LBConfig. This is an internal invariant violation — the builder and the expected return type are from the same package.","commonSituations":"Version skew or package shadowing where a different outlierdetection package is used for the builder vs. the type assertion. A forked outlier detection package that changed its config type. Extremely unlikely in stock grpc-go.","solutions":["Verify all grpc-go internal packages resolve to the same module version: 'go list -m -json google.golang.org/grpc'.","Check for module shadowing or replace directives in go.mod that might pull a different outlierdetection package.","Report as a bug to grpc-go if versions are consistent.","Clean module cache and re-download: 'go clean -modcache && go mod download'."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Validate that the OD parser returns the expected type (debug check)\nfunc validateODParserType() error {\n    b := balancer.Get(outlierdetection.Name)\n    if b == nil {\n        return fmt.Errorf(\"OD not registered\")\n    }\n    parser, ok := b.(balancer.ConfigParser)\n    if !ok {\n        return fmt.Errorf(\"OD lacks parser\")\n    }\n    cfg, err := parser.ParseConfig(json.RawMessage(`{}`))\n    if err != nil {\n        return fmt.Errorf(\"OD parse failed: %w\", err)\n    }\n    if _, ok := cfg.(*outlierdetection.LBConfig); !ok {\n        return fmt.Errorf(\"OD parser returned wrong type %T\", cfg)\n    }\n    return nil\n}","typeGuard":"func isODConfig(cfg serviceconfig.LoadBalancingConfig) bool {\n    _, ok := cfg.(*outlierdetection.LBConfig)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Ensure all grpc-go internal packages are from the same module version.","Avoid module shadowing via replace directives.","Clean and re-download the module cache if this error appears."],"tags":["xds","outlier-detection","type-assertion","internal-invariant"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}