grpc/grpc-go · error
rls_csp: error marshaling route lookup config
Error message
rls_csp: error marshaling route lookup config: %v: %v
What it means
After successfully unmarshaling the RouteLookupClusterSpecifier, the embedded RouteLookupConfig sub-message could not be serialized to JSON via protojson.Marshal (rls.go:67-69). This typically means RouteLookupConfig is nil or contains data that violates protojson serialization invariants.
Solutions
- Ensure the xDS server always includes a non-nil RouteLookupConfig in the RouteLookupClusterSpecifier
- Validate the RouteLookupConfig proto for completeness before deploying the xDS config
- Check for proto version differences in the RouteLookupConfig schema
Defensive patterns
Strategy: validation
Validate before calling
// Verify RouteLookupConfig is non-nil before processing.
rlcs := new(rlspb.RouteLookupClusterSpecifier)
_ = anyMsg.UnmarshalTo(rlcs)
if rlcs.GetRouteLookupConfig() == nil {
return fmt.Errorf("RouteLookupClusterSpecifier must include a non-nil RouteLookupConfig")
} Prevention
- Validate RouteLookupConfig is non-nil on the xDS server before sending
- Use proto validation tools (e.g. protoc-gen-validate) to enforce required fields in RouteLookupConfig
- Test RLS configs end-to-end with a local xDS server before production deployment
When it happens
Trigger: rlcs.GetRouteLookupConfig() returns nil or an invalid proto, causing protojson.Marshal to fail when converting the RouteLookupConfig to the JSON form needed for the LB policy configuration.
Common situations: xDS server sends a RouteLookupClusterSpecifier with a nil RouteLookupConfig field; required sub-fields of RouteLookupConfig are missing or invalid; proto version differences in the RouteLookupConfig schema between server and client.
Related errors
- rls_csp: error marshaling load balancing config
- rls_csp: error parsing config
- rls_csp: error parsing config
- rls_csp: nil configuration message provided
- rls_csp: validation error from rls lb policy parsing
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/837cec548d6c9b67.
Report an issue: GitHub.
Appendix: 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 0c51461d27)