grpc/grpc-go · error
rls_csp: error marshaling route lookup config: %v: %v
Error message
rls_csp: error marshaling route lookup config: %v: %v
What it means
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.
Source
Thrown at internal/xds/clusterspecifier/rls/rls.go:69
ChildPolicyConfigTargetFieldName string `json:"childPolicyConfigTargetFieldName"`
}
func (rls) ParseClusterSpecifierConfig(cfg proto.Message) (clusterspecifier.BalancerConfig, error) {
if cfg == nil {
return nil, fmt.Errorf("rls_csp: nil configuration message provided")
}
m, ok := cfg.(*anypb.Any)
if !ok {
return nil, fmt.Errorf("rls_csp: error parsing config %v: unknown type %T", cfg, cfg)
}
rlcs := new(rlspb.RouteLookupClusterSpecifier)
if err := m.UnmarshalTo(rlcs); err != nil {
return nil, fmt.Errorf("rls_csp: error parsing config %v: %v", cfg, err)
}
rlcJSON, err := protojson.Marshal(rlcs.GetRouteLookupConfig())
if err != nil {
return nil, fmt.Errorf("rls_csp: error marshaling route lookup config: %v: %v", rlcs.GetRouteLookupConfig(), err)
}
lbCfgJSON := &lbConfigJSON{
RouteLookupConfig: rlcJSON, // "JSON form of RouteLookupClusterSpecifier.config" - RLS in xDS Design Doc
ChildPolicy: []map[string]json.RawMessage{
{
"cds_experimental": json.RawMessage(`{"isDynamic":true}`),
},
},
ChildPolicyConfigTargetFieldName: "cluster",
}
rawJSON, err := json.Marshal(lbCfgJSON)
if err != nil {
return nil, fmt.Errorf("rls_csp: error marshaling load balancing config %v: %v", lbCfgJSON, err)
}
rlsBB := balancer.Get(internal.RLSLoadBalancingPolicyName)
if rlsBB == nil {View on GitHub (pinned to 03255a9237)
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.
Defensive patterns
Strategy: validation
Prevention
- 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.
When it happens
Trigger: 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.).
Common situations: 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.
Related errors
- rls_csp: error parsing config %v: %v
- rls_csp: error marshaling load balancing config %v: %v
- rls: json unmarshal failed for service config %+v: %v
- rls: bad RouteLookupConfig proto %+v: %v
- rls: failed to parse lookup_service_timeout in route lookup
AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07).
Data as JSON: /api/errors/837cec548d6c9b67.
Report an issue: GitHub.