{"record":{"id":"fdea082d890c48d1","repo":"grpc/grpc-go","slug":"rls-grpckeybuilder-in-routelookupconfig-does-not","errorCode":null,"errorMessage":"rls: GrpcKeyBuilder in RouteLookupConfig does not contain any Name {%+v}","messagePattern":"rls: GrpcKeyBuilder in RouteLookupConfig does not contain any Name (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/rls/internal/keys/builder.go","lineNumber":87,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig contains repeated key %q in extra_keys from constant_keys or headers {%+v}\", kb.GetExtraKeys().GetService(), kbs)\n\t\t}\n\t\tif seenKeys[kb.GetExtraKeys().GetMethod()] {\n\t\t\treturn nil, fmt.Errorf(\"rls: GrpcKeyBuilder in RouteLookupConfig contains repeated key %q in extra_keys from constant_keys or headers {%+v}\", kb.GetExtraKeys().GetMethod(), kbs)\n\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","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/rls/internal/keys/builder.go#L69-L105","documentation":"Each GrpcKeyBuilder must declare at least one Name (a service/method or service-wide binding) so the RLS LB knows which request paths the builder applies to (builder.go:85-87). A GrpcKeyBuilder with headers/constant_keys but no Names has no routing scope and is rejected, because BuilderMap would have nowhere to register it.","triggerScenarios":"A GrpcKeyBuilder inside RouteLookupConfig.grpc_keybuilders has an empty Names slice. The check `len(names) == 0` at builder.go:86 returns this error.","commonSituations":"Partially constructed key builder protos; a config editor that adds header matchers but forgets the Name binding; an xDS config push missing the names field.","solutions":["Add at least one Name with a non-empty Service (Method may be empty for service-wide matching) to the offending GrpcKeyBuilder.","If the builder is vestigial, remove it from grpc_keybuilders entirely."],"exampleFix":"// before\nkb := &rlspb.GrpcKeyBuilder{\n  ConstantKeys: map[string]string{\"region\": \"us\"},\n  // Names missing\n}\n// after\nkb := &rlspb.GrpcKeyBuilder{\n  ConstantKeys: map[string]string{\"region\": \"us\"},\n  Names:         []*rlspb.GrpcKeyBuilder_Name{{Service: \"my.pkg.Svc\", Method: \"Do\"}},\n}","handlingStrategy":"validation","validationCode":"func validateNamesPresent(cfg *rlspb.RouteLookupConfig) error {\n\tfor i, kb := range cfg.GetGrpcKeybuilders() {\n\t\tif len(kb.GetNames()) == 0 {\n\t\t\treturn fmt.Errorf(\"grpc_keybuilders[%d] has no Name\", i)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every GrpcKeyBuilder must bind to at least one Service (and optional Method).","Remove builders you do not need instead of leaving them half-specified.","Test configs through keys.MakeBuilderMap."],"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"}