{"record":{"id":"9bc7a35186caa90d","repo":"grpc/grpc-go","slug":"router-nil-configuration-message-provided","errorCode":null,"errorMessage":"router: nil configuration message provided","messagePattern":"router: nil configuration message provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/httpfilter/router/router.go","lineNumber":55,"sourceCode":"\thttpfilter.Register(builder{})\n}\n\n// IsRouterFilter returns true iff b is a Router filter builder.\nfunc IsRouterFilter(b httpfilter.Builder) bool {\n\t_, ok := b.(builder)\n\treturn ok\n}\n\ntype builder struct {\n}\n\nfunc (builder) TypeURLs() []string { return []string{TypeURL} }\n\nfunc (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {\n\t// The gRPC router filter does not currently use any fields from the\n\t// config.  Verify type only.\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"router: nil configuration message provided\")\n\t}\n\tm, ok := cfg.(*anypb.Any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"router: error parsing config %v: unknown type %T\", cfg, cfg)\n\t}\n\tmsg := new(pb.Router)\n\tif err := m.UnmarshalTo(msg); err != nil {\n\t\treturn nil, fmt.Errorf(\"router: error parsing config %v: %v\", cfg, err)\n\t}\n\treturn config{}, nil\n}\n\nfunc (builder) ParseFilterConfigOverride(override proto.Message) (httpfilter.FilterConfig, error) {\n\tif override != nil {\n\t\treturn nil, fmt.Errorf(\"router: unexpected config override specified: %v\", override)\n\t}\n\treturn config{}, nil\n}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/httpfilter/router/router.go#L37-L73","documentation":"The router filter's ParseFilterConfig rejects a nil config message. Although the router ignores the config body (it only verifies the type), it still requires a non-nil typed_config so the filter entry is well-formed.","triggerScenarios":"An LDS HTTP filter chain entry references the router filter but supplies no typed_config (nil).","commonSituations":"Control plane emitting a router filter entry without a body; minimal/templated xDS resources missing the router config; custom xDS server bug.","solutions":["Ensure the router filter entry carries a typed_config Any wrapping envoy.extensions.filters.http.router.v3.Router.","Validate LDS resources on the control plane before serving."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func ensureRouterFilterConfigPresent(filters []*hcmpb.HttpFilter) error {\n\tfor _, f := range filters {\n\t\tif isRouterFilter(f) && f.GetTypedConfig() == nil {\n\t\t\treturn fmt.Errorf(\"router filter %q has nil typed_config\", f.GetName())\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always emit a typed_config for router filter entries even though its body is ignored.","Validate LDS resources for non-nil typed_config at the control plane."],"tags":["router","xds","grpc","config-validation"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}