grpc/grpc-go · error

rls_csp: error parsing config %v: %v

Error message

rls_csp: error parsing config %v: %v

What it means

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.

Source

Thrown at internal/xds/clusterspecifier/rls/rls.go:65

// configuration, and the other fields will be hardcoded.
type lbConfigJSON struct {
	RouteLookupConfig                json.RawMessage              `json:"routeLookupConfig"`
	ChildPolicy                      []map[string]json.RawMessage `json:"childPolicy"`
	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)

View on GitHub (pinned to 03255a9237)

Solutions

  1. Verify the Any's type_url is type.googleapis.com/grpc.lookup.v1.RouteLookupClusterSpecifier and its value decodes as that proto.
  2. Align grpc-go / RLS proto versions on client and server.
  3. Inspect the %v (the unmarshal error) to see whether it is a wire-format error or a wrong-message-type error.
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := rls{}.ParseClusterSpecifierConfig(anyCfg); err != nil {
    logger.Errorf("invalid RLS cluster specifier from server: %v", err)
    // NACK via the normal xDS resource error path; do not serve this route
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/bb9a70db77960076. Report an issue: GitHub.