{"record":{"id":"09916d86f4ede893","repo":"grpc/grpc-go","slug":"grpctransport-unknown-config-name-q-specified-in","errorCode":null,"errorMessage":"grpctransport: unknown config name %q specified in ServerIdentifierExtension","messagePattern":"grpctransport: unknown config name %q specified in ServerIdentifierExtension","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clients/grpctransport/grpc_transport.go","lineNumber":103,"sourceCode":"\n// Build returns a gRPC-based clients.Transport.\n//\n// The Extension field of the ServerIdentifier must be a ServerIdentifierExtension.\nfunc (b *Builder) Build(si clients.ServerIdentifier) (clients.Transport, error) {\n\tif si.ServerURI == \"\" {\n\t\treturn nil, fmt.Errorf(\"grpctransport: ServerURI is not set in ServerIdentifier\")\n\t}\n\tif si.Extensions == nil {\n\t\treturn nil, fmt.Errorf(\"grpctransport: Extensions is not set in ServerIdentifier\")\n\t}\n\tsce, ok := si.Extensions.(ServerIdentifierExtension)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"grpctransport: Extensions field is %T, but must be %T in ServerIdentifier\", si.Extensions, ServerIdentifierExtension{})\n\t}\n\n\tconfig, ok := b.configs[sce.ConfigName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"grpctransport: unknown config name %q specified in ServerIdentifierExtension\", sce.ConfigName)\n\t}\n\tif config.Credentials == nil {\n\t\treturn nil, fmt.Errorf(\"grpctransport: config %q has nil credentials bundle\", sce.ConfigName)\n\t}\n\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif cc, ok := b.connections[si]; ok {\n\t\tif logger.V(2) {\n\t\t\tlogger.Infof(\"Reusing existing connection to the server for ServerIdentifier: %v\", si)\n\t\t}\n\t\tb.refs[si]++\n\t\ttr := &grpcTransport{cc: cc}\n\t\ttr.cleanup = b.cleanupFunc(si, tr)\n\t\treturn tr, nil\n\t}\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clients/grpctransport/grpc_transport.go#L85-L121","documentation":"After extracting the ConfigName from the extension, Build looks it up in the configs map passed to NewBuilder (grpc_transport.go:101-103). If ConfigName is not a key in that map, the transport has no credentials/configuration to use and Build fails. The unknown name is reported.","triggerScenarios":"The ServerIdentifierExtension.ConfigName does not match any key in the map[string]Config given to NewBuilder. A typo, a stale name, or a missing config entry triggers this.","commonSituations":"The configs map was built with key \"prod\" but the extension references \"default\"; renaming a config in one place but not the other; the extension's ConfigName was left empty (empty string is not in the map).","solutions":["Ensure the ConfigName in the extension exactly matches a key in the configs map passed to NewBuilder.","If ConfigName is empty, set it to a valid key.","Centralize the config name as a shared constant to avoid drift between the map and the extension."],"exampleFix":"// before:\n//   builder := grpctransport.NewBuilder(map[string]Config{\"prod\": cfg})\n//   si.Extensions = grpctransport.ServerIdentifierExtension{ConfigName: \"default\"}\n// after:\n//   builder := grpctransport.NewBuilder(map[string]Config{\"prod\": cfg})\n//   si.Extensions = grpctransport.ServerIdentifierExtension{ConfigName: \"prod\"}","handlingStrategy":"validation","validationCode":"func configExists(configs map[string]grpctransport.Config, name string) error {\n    if _, ok := configs[name]; !ok {\n        return fmt.Errorf(\"no config named %q; available: %v\", name, maps.Keys(configs))\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define config names as shared constants referenced by both NewBuilder and the extension.","Validate ConfigName against the configs map before calling Build."],"tags":["xds","grpctransport","config","grpc"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}