{"record":{"id":"78b6e66c0ebdf4fa","repo":"grpc/grpc-go","slug":"rls-grpckeybuilder-in-routelookupconfig-contains-78b6e6","errorCode":null,"errorMessage":"rls: GrpcKeyBuilder in RouteLookupConfig contains a Name field with no Service {%+v}","messagePattern":"rls: GrpcKeyBuilder in RouteLookupConfig contains a Name field with no Service (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/rls/internal/keys/builder.go","lineNumber":91,"sourceCode":"\t\t}\n\t\tb := builder{\n\t\t\theaderKeys:   matchers,\n\t\t\tconstantKeys: constantKeys,\n\t\t\thostKey:      kb.GetExtraKeys().GetHost(),\n\t\t\tserviceKey:   kb.GetExtraKeys().GetService(),\n\t\t\tmethodKey:    kb.GetExtraKeys().GetMethod(),\n\t\t}\n\n\t\t// Store the builder created above in the BuilderMap based on the value\n\t\t// of the `Names` field, which wraps incoming request's service and\n\t\t// method. Also, ensure that there are no repeated `Names` field.\n\t\tnames := kb.GetNames()\n\t\tif len(names) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig does not contain any Name {%+v}\", kbs)\n\t\t}\n\t\tfor _, name := range names {\n\t\t\tif name.GetService() == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig contains a Name field with no Service {%+v}\", kbs)\n\t\t\t}\n\t\t\tif strings.Contains(name.GetMethod(), `/`) {\n\t\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig contains a method with a slash {%+v}\", kbs)\n\t\t\t}\n\t\t\tpath := \"/\" + name.GetService() + \"/\" + name.GetMethod()\n\t\t\tif _, ok := bm[path]; ok {\n\t\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig contains repeated Name field {%+v}\", kbs)\n\t\t\t}\n\t\t\tbm[path] = b\n\t\t}\n\t}\n\treturn bm, nil\n}\n\n// KeyMap represents the RLS keys to be used for a request.\ntype KeyMap struct {\n\t// Map is the representation of an RLS key as a Go map. This is used when\n\t// an actual RLS request is to be sent out on the wire, since the","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/rls/internal/keys/builder.go#L73-L109","documentation":"Inside a GrpcKeyBuilder, each Name must carry a non-empty Service because the service component is what the builder map is keyed against (builder.go:89-91). A Name with only a Method and no Service is ambiguous: it cannot be turned into a \"/service/method\" or \"/service/\" path. grpc-go rejects it rather than guessing.","triggerScenarios":"A GrpcKeyBuilder.Name with Method=\"Do\" but Service=\"\" (or Service omitted). Caught at builder.go:90 where name.GetService() returns \"\".","commonSituations":"Building Name protos programmatically and forgetting to populate Service; truncating a config; assuming Method alone is enough.","solutions":["Set Name.Service to the fully-qualified gRPC service name (e.g., \"my.pkg.Greeter\") for every Name entry.","Leave Method empty if you want the builder to match every method on that service."],"exampleFix":"// before\nkb.Names = []*rlspb.Name{{Method: \"SayHello\"}} // Service empty\n// after\nkb.Names = []*rlspb.Name{{Service: \"my.pkg.Greeter\", Method: \"SayHello\"}}","handlingStrategy":"validation","validationCode":"func validateNamesHaveService(cfg *rlspb.RouteLookupConfig) error {\n\tfor _, kb := range cfg.GetGrpcKeybuilders() {\n\t\tfor _, n := range kb.GetNames() {\n\t\t\tif n.GetService() == \"\" {\n\t\t\t\treturn fmt.Errorf(\"GrpcKeyBuilder Name missing Service\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set Name.Service to the fully-qualified gRPC service name.","Leave Method empty for service-wide matching rather than dropping Service.","Validate the proto before sending/applying it."],"tags":["go","grpc","rls","config","validation","balancer"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}