{"record":{"id":"92995a119b31712d","repo":"grpc/grpc-go","slug":"rls-csp-nil-configuration-message-provided","errorCode":null,"errorMessage":"rls_csp: nil configuration message provided","messagePattern":"rls_csp: nil configuration message provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clusterspecifier/rls/rls.go","lineNumber":56,"sourceCode":"\ntype rls struct{}\n\nfunc (rls) TypeURLs() []string {\n\treturn []string{\"type.googleapis.com/grpc.lookup.v1.RouteLookupClusterSpecifier\"}\n}\n\n// lbConfigJSON is the RLS LB Policies configuration in JSON format.\n// RouteLookupConfig will be a raw JSON string from the passed in proto\n// configuration, and the other fields will be hardcoded.\ntype lbConfigJSON struct {\n\tRouteLookupConfig                json.RawMessage              `json:\"routeLookupConfig\"`\n\tChildPolicy                      []map[string]json.RawMessage `json:\"childPolicy\"`\n\tChildPolicyConfigTargetFieldName string                       `json:\"childPolicyConfigTargetFieldName\"`\n}\n\nfunc (rls) ParseClusterSpecifierConfig(cfg proto.Message) (clusterspecifier.BalancerConfig, error) {\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"rls_csp: nil configuration message provided\")\n\t}\n\tm, ok := cfg.(*anypb.Any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"rls_csp: error parsing config %v: unknown type %T\", cfg, cfg)\n\t}\n\trlcs := new(rlspb.RouteLookupClusterSpecifier)\n\n\tif err := m.UnmarshalTo(rlcs); err != nil {\n\t\treturn nil, fmt.Errorf(\"rls_csp: error parsing config %v: %v\", cfg, err)\n\t}\n\trlcJSON, err := protojson.Marshal(rlcs.GetRouteLookupConfig())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"rls_csp: error marshaling route lookup config: %v: %v\", rlcs.GetRouteLookupConfig(), err)\n\t}\n\tlbCfgJSON := &lbConfigJSON{\n\t\tRouteLookupConfig: rlcJSON, // \"JSON form of RouteLookupClusterSpecifier.config\" - RLS in xDS Design Doc\n\t\tChildPolicy: []map[string]json.RawMessage{\n\t\t\t{","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/clusterspecifier/rls/rls.go#L38-L74","documentation":"The RLS cluster specifier plugin's ParseClusterSpecifierConfig was called with a nil proto.Message (rls.go:55-56). The parser requires a non-nil configuration to extract the RLS route lookup settings from the xDS resource.","triggerScenarios":"clusterspecifier.ParseClusterSpecifierConfig is called with cfg == nil, either directly by test code or through the xDS resource processing pipeline when an RLS cluster specifier resource arrives from the management server with no configuration payload.","commonSituations":"xDS management server sends an RLS cluster specifier resource with an empty or null config field; route configuration references the RLS cluster specifier type URL but omits the config payload; xDS protocol version mismatch where the server omits a required field.","solutions":["Ensure the xDS server sends a valid RouteLookupClusterSpecifier proto for RLS cluster resources","Check the route configuration on the xDS server for missing RLS config fields","Verify the resource type URL matches 'type.googleapis.com/grpc.lookup.v1.RouteLookupClusterSpecifier'"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard against nil config before calling ParseClusterSpecifierConfig.\nfunc isNonNilConfig(cfg proto.Message) bool {\n    return cfg != nil\n}","tryCatchPattern":null,"preventionTips":["Validate xDS server config payloads for nil RLS cluster specifier configs before deployment","Use xDS config dump tools to inspect RLS cluster specifier resources for nil or empty configs","Add server-side validation that rejects RLS resources without configuration payloads"],"tags":["rls","xds","cluster-specifier","configuration"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}