{"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/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clusterspecifier/rls/rls.go#L38-L74","documentation":"Returned by the RLS cluster specifier plugin's ParseClusterSpecifierConfig when the proto.Message argument is nil. The clusterspecifier framework calls this with the Any-wrapped config from an xDS RouteAction.cluster_specifier_plugin; a nil here means the plugin was invoked without a config body.","triggerScenarios":"An xDS route configuration references the RLS cluster specifier plugin (type URL grpc.lookup.v1.RouteLookupClusterSpecifier) but supplies no configuration message, or the framework hands nil through a malformed code path.","commonSituations":"Server-side route config that declares an RLS cluster_specifier_plugin with an empty/missing config, or a control-plane bug that drops the typed_struct/any body.","solutions":["On the management server, ensure the RLS cluster_specifier_plugin entry has a fully populated RouteLookupClusterSpecifier config.","Validate the route configuration before publishing (e.g. with the control plane's validator).","If hit during testing of a custom cluster specifier flow, make sure you pass a non-nil proto.Message."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":"func isNonNilClusterCfg(cfg proto.Message) bool { return cfg != nil }","tryCatchPattern":null,"preventionTips":["Ensure the management server publishes a complete RouteLookupClusterSpecifier config.","Validate route configuration on the server side before pushing.","Pass a non-nil proto when calling ParseClusterSpecifierConfig directly."],"tags":["grpc","xds","rls","cluster-specifier","config"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}