{"record":{"id":"bb9a70db77960076","repo":"grpc/grpc-go","slug":"rls-csp-error-parsing-config-v-v","errorCode":null,"errorMessage":"rls_csp: error parsing config %v: %v","messagePattern":"rls_csp: error parsing config (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clusterspecifier/rls/rls.go","lineNumber":65,"sourceCode":"// 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{\n\t\t\t\t\"cds_experimental\": json.RawMessage(`{\"isDynamic\":true}`),\n\t\t\t},\n\t\t},\n\t\tChildPolicyConfigTargetFieldName: \"cluster\",\n\t}\n\n\trawJSON, err := json.Marshal(lbCfgJSON)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"rls_csp: error marshaling load balancing config %v: %v\", lbCfgJSON, err)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clusterspecifier/rls/rls.go#L47-L83","documentation":"Returned when the *anypb.Any unmarshals but its payload is not a valid grpc.lookup.v1.RouteLookupClusterSpecifier (m.UnmarshalTo(rlcs) fails). The RLS plugin cannot proceed; the route config is rejected.","triggerScenarios":"An xDS route config supplies an RLS cluster specifier whose Any payload is malformed, carries the wrong message type, or whose type_url does not match RouteLookupClusterSpecifier.","commonSituations":"Control plane serializing the wrong message into the RLS plugin's config, type_url mismatch between client and server proto registries, or a corrupted/partial config push.","solutions":["Verify the Any's type_url is type.googleapis.com/grpc.lookup.v1.RouteLookupClusterSpecifier and its value decodes as that proto.","Align grpc-go / RLS proto versions on client and server.","Inspect the %v (the unmarshal error) to see whether it is a wire-format error or a wrong-message-type error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := rls{}.ParseClusterSpecifierConfig(anyCfg); err != nil {\n    logger.Errorf(\"invalid RLS cluster specifier from server: %v\", err)\n    // NACK via the normal xDS resource error path; do not serve this route\n}","preventionTips":["Make the server emit Any payloads with the correct type_url for RouteLookupClusterSpecifier.","Keep RLS proto versions aligned across client and server.","Log unmarshal errors with the type_url to spot mismatches quickly."],"tags":["grpc","xds","rls","protobuf","config"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}