{"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/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/clients/grpctransport/grpc_transport.go#L85-L121","documentation":"Returned when ServerIdentifierExtension.ConfigName does not match any key in the configs map passed to NewBuilder (grpc_transport.go:103). The Builder uses ConfigName to look up the credentials bundle, so an unknown name means the credentials cannot be resolved.","triggerScenarios":"builder := grpctransport.NewBuilder(map[string]Config{\"insecure\": ...}); then Build with a ServerIdentifier whose Extension has ConfigName=\"mtls\" which is not a key in the map.","commonSituations":"Typo in the config name; config map keys are generated from one source (e.g. bootstrap) and the ServerIdentifier from another and they disagree; refactoring renamed a key but not all references; bootstrap credentials section was pruned.","solutions":["Cross-check the ConfigName against the keys passed to grpctransport.NewBuilder.","If the name comes from bootstrap, ensure the credentials entry exists under \"grpc_xds_configs\" / the configured configs section.","Log both the available keys and the requested name at startup to catch drift."],"exampleFix":"// before\nb := grpctransport.NewBuilder(map[string]Config{\"insecure\": {Credentials: creds}})\nsi.Extensions = grpctransport.ServerIdentifierExtension{ConfigName: \"mtls\"}\n\n// after\nb := grpctransport.NewBuilder(map[string]Config{\"mtls\": {Credentials: creds}})\nsi.Extensions = grpctransport.ServerIdentifierExtension{ConfigName: \"mtls\"}","handlingStrategy":"validation","validationCode":"func resolveConfig(b *grpctransport.Builder, name string) (grpctransport.Config, error) {\n    // Builder.configs is private; expose a Contains() helper or track keys at the call site.\n    // Validation pattern: keep the keys you registered and check membership.\n    return grpctransport.Config{}, nil\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unknown config name\") {\n    // log registered config keys vs requested name, then correct the mismatch\n}","preventionTips":["Define config-name constants and reference them in both NewBuilder and the ServerIdentifierExtension.","At startup, log every config key you registered.","Unit-test that each ServerIdentifierExtension.ConfigName resolves."],"tags":["grpctransport","xds","configuration","credentials"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}