{"record":{"id":"837cec548d6c9b67","repo":"grpc/grpc-go","slug":"rls-csp-error-marshaling-route-lookup-config-v","errorCode":null,"errorMessage":"rls_csp: error marshaling route lookup config: %v: %v","messagePattern":"rls_csp: error marshaling route lookup config: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clusterspecifier/rls/rls.go","lineNumber":69,"sourceCode":"\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)\n\t}\n\n\trlsBB := balancer.Get(internal.RLSLoadBalancingPolicyName)\n\tif rlsBB == nil {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clusterspecifier/rls/rls.go#L51-L87","documentation":"Returned when protojson.Marshal of the RouteLookupConfig (extracted from the decoded RouteLookupClusterSpecifier) fails. protojson marshaling fails only on a structurally invalid proto (e.g. an InvalidUTF8 error in a string field or a oneof/required violation), so this indicates a bad RouteLookupConfig payload.","triggerScenarios":"The server-provided RouteLookupConfig proto, while decodable as a message, contains values that protojson cannot serialize — most commonly invalid UTF-8 in string fields (grpc_key_builder keys, headers, etc.).","commonSituations":"A control plane populating RLS config with non-UTF-8 bytes or leaving required-looking fields in an inconsistent state; rare under normal Envoy/Traffic Director output.","solutions":["Inspect the %v (the protojson error) — an InvalidUTF8 error points to a specific field.","Correct the RouteLookupConfig on the server so all string fields are valid UTF-8.","If using a custom RLS config generator, validate strings before serialization."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure all string fields in RouteLookupConfig are valid UTF-8 on the server.","Validate the RouteLookupConfig with protojson.Marshal before publishing.","Inspect the protojson error to find the offending field."],"tags":["grpc","xds","rls","protobuf","json"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}