{"record":{"id":"f9add31e63a98989","repo":"grpc/grpc-go","slug":"extauthz-error-parsing-config-v-unknown-type-t","errorCode":null,"errorMessage":"extauthz: error parsing config %v: unknown type %T, want *anypb.Any","messagePattern":"extauthz: error parsing config (.+?): unknown type %T, want \\*anypb\\.Any","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/httpfilter/ext_authz/ext_authz.go","lineNumber":95,"sourceCode":"\t}\n\n\t// If the numerator exceeds the denominator, cap the fractional value at 100%.\n\tnum := min(fracPercent.GetNumerator(), den)\n\treturn fraction{numerator: num, denominator: den}, nil\n}\n\n// grpcStatusCode converts an HTTP status code to a gRPC status code.\nfunc grpcStatusCode(httpStatus int32) codes.Code {\n\tif code, ok := transport.HTTPStatusConvTab[int(httpStatus)]; ok {\n\t\treturn code\n\t}\n\treturn codes.Unknown\n}\n\nfunc (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {\n\tm, ok := cfg.(*anypb.Any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"extauthz: error parsing config %v: unknown type %T, want *anypb.Any\", cfg, cfg)\n\t}\n\tmsg := new(v3extauthzpb.ExtAuthz)\n\tif err := m.UnmarshalTo(msg); err != nil {\n\t\treturn nil, fmt.Errorf(\"extauthz: failed to unmarshal config: %v\", err)\n\t}\n\n\tif msg.GetGrpcService() == nil {\n\t\treturn nil, fmt.Errorf(\"extauthz: empty grpc_service provided in config %v\", cfg)\n\t}\n\tserver, err := parseGRPCServiceConfig(msg.GetGrpcService())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"extauthz: failed to parse grpc_service: %v\", err)\n\t}\n\n\tfilterEnabled, err := parseFilterEnabled(msg.GetFilterEnabled())\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/httpfilter/ext_authz/ext_authz.go#L77-L113","documentation":"Returned at the top of ext_authz builder.ParseFilterConfig when the proto.Message argument is not a *anypb.Any. The httpfilter framework always supplies *anypb.Any, so a non-Any type indicates a framework misuse or a direct call with the wrong type.","triggerScenarios":"A direct invocation of ParseFilterConfig with a raw *v3extauthzpb.ExtAuthz instead of *anypb.Any, or an integration bug that fails to Any-wrap the config.","commonSituations":"Custom test code or a forked httpfilter dispatcher that passes concrete proto types; normal xDS-driven parsing always provides *anypb.Any.","solutions":["When calling ParseFilterConfig directly, wrap the proto with anypb.New first.","If reached through the standard xDS path, report it as a framework integration bug."],"exampleFix":"// before\ncfg, err := b.ParseFilterConfig(extAuthzProto) // *v3extauthzpb.ExtAuthz\n\n// after\nany, _ := anypb.New(extAuthzProto)\ncfg, err := b.ParseFilterConfig(any)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isExtAuthzAny(m proto.Message) (*anypb.Any, bool) {\n    a, ok := m.(*anypb.Any)\n    return a, ok\n}","tryCatchPattern":null,"preventionTips":["Always pass *anypb.Any to httpfilter ParseFilterConfig methods.","Let the framework Any-wrap; avoid direct calls with raw protos.","Add a type assertion in test helpers to catch misuse early."],"tags":["grpc","xds","ext-authz","type-error","filter"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}