{"record":{"id":"93515473f3defe33","repo":"grpc/grpc-go","slug":"router-error-parsing-config-v-unknown-type-t","errorCode":null,"errorMessage":"router: error parsing config %v: unknown type %T","messagePattern":"router: error parsing config (.+?): unknown type %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/httpfilter/router/router.go","lineNumber":59,"sourceCode":"func 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}\n\nfunc (builder) IsTerminal() bool {\n\treturn true\n}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/httpfilter/router/router.go#L41-L77","documentation":"ParseFilterConfig expects an *anypb.Any. Any other concrete Go type indicates the xDS marshaling layer delivered the wrong type to the router builder - an internal wiring issue.","triggerScenarios":"A non-Any proto.Message is passed to the router's ParseFilterConfig.","commonSituations":"Custom xDS client bypassing the Any convention; version skew; a fork altering the marshaling pipeline.","solutions":["Ensure xDS marshaling wraps router config in *anypb.Any before invoking the builder.","Verify the resource @type matches the router TypeURL."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isAny(m proto.Message) bool { _, ok := m.(*anypb.Any); return ok }","tryCatchPattern":null,"preventionTips":["Wrap router config in *anypb.Any in marshaling code.","Use the standard grpc-go xdsclient for consistent typing."],"tags":["router","xds","grpc","type-mismatch"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}