{"record":{"id":"155074cb7ce1f43c","repo":"grpc/grpc-go","slug":"missing-server-listener-resource-name-template-in","errorCode":null,"errorMessage":"missing server_listener_resource_name_template in the bootstrap configuration","messagePattern":"missing server_listener_resource_name_template in the bootstrap configuration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"xds/server.go","lineNumber":111,"sourceCode":"\t// Initializing the xDS client upfront (instead of at serving time)\n\t// simplifies the code by eliminating the need for a mutex to protect the\n\t// xdsC and xdsClientClose fields.\n\tpool := xdsClientPool\n\tif s.opts.clientPoolForTesting != nil {\n\t\tpool = s.opts.clientPoolForTesting\n\t}\n\txdsClient, xdsClientClose, err := pool.NewClient(xdsclient.NameForServer, mrl)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xDS client creation failed: %v\", err)\n\t}\n\n\t// Validate the bootstrap configuration for server specific fields.\n\n\t// Listener resource name template is mandatory on the server side.\n\tcfg := xdsClient.BootstrapConfig()\n\tif cfg.ServerListenerResourceNameTemplate() == \"\" {\n\t\txdsClientClose()\n\t\treturn nil, errors.New(\"missing server_listener_resource_name_template in the bootstrap configuration\")\n\t}\n\n\ts.xdsC = xdsClient\n\ts.xdsClientClose = xdsClientClose\n\n\ts.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(serverPrefix, s))\n\ts.logger.Infof(\"Created xds.GRPCServer\")\n\n\treturn s, nil\n}\n\n// handleServerOptions iterates through the list of server options passed in by\n// the user, and handles the xDS server specific options.\nfunc (s *GRPCServer) handleServerOptions(opts []grpc.ServerOption) {\n\tso := s.defaultServerOptions()\n\tfor _, opt := range opts {\n\t\tif o, ok := opt.(*serverOption); ok {\n\t\t\to.apply(so)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/xds/server.go#L93-L129","documentation":"Returned by xds.NewGRPCServer (xds/server.go:111) when the xDS client's bootstrap configuration has an empty server_listener_resource_name_template. On the server side this template is mandatory because gRPC uses it to derive the Listener resource name it subscribes to (e.g. 'grpc/server?<ip:port>'); without it the server cannot know which xDS Listener resource to watch, so construction fails fast. NewGRPCServer also closes the freshly created xDS client before returning the error.","triggerScenarios":"Calling xds.NewGRPCServer(opts...) where GRPC_XDS_BOOTSTRAP (or the bootstrap file at the default path) lacks the server_listener_resource_name_template field, or it is present but empty. Also triggered when the env var points at a bootstrap JSON intended only for clients.","commonSituations":"Reusing a client-only bootstrap file for an xDS server; bootstrap generated by a control plane that omits the server template; typo in the field name; bootstrap env var unset so a client-style default is synthesized.","solutions":["Add a non-empty server_listener_resource_name_template to the bootstrap JSON, e.g. \"grpc/server?%s\" (the %s is replaced with the server's IP:port).","Point GRPC_XDS_BOOTSTRAP at a bootstrap file that includes the xds_servers entry AND server_listener_resource_name_template.","Regenerate the bootstrap from your control plane / bootstrap generator with server-side fields enabled.","Verify after construction by reading xdsClient.BootstrapConfig().ServerListenerResourceNameTemplate() before calling Serve."],"exampleFix":"// before (bootstrap.json)\n{\n  \"xds_servers\": [{ \"server_config\": {...} }]\n}\n// -> NewGRPCServer fails: missing server_listener_resource_name_template\n\n// after\n{\n  \"xds_servers\": [{ \"server_config\": {...} }],\n  \"server_listener_resource_name_template\": \"grpc/server?%s\"\n}","handlingStrategy":"validation","validationCode":"// Validate the bootstrap has the server template before constructing the xDS server.\nimport \"google.golang.org/grpc/xds\"\n\nif os.Getenv(\"GRPC_XDS_BOOTSTRAP\") == \"\" && os.Getenv(\"GRPC_XDS_BOOTSTRAP_FILE_CONTENT\") == \"\" {\n    log.Fatal(\"xDS bootstrap not configured\")\n}\n// Optionally parse the bootstrap JSON and assert server_listener_resource_name_template != \"\".","typeGuard":null,"tryCatchPattern":"gs, err := xds.NewGRPCServer(opts...)\nif err != nil {\n    if strings.Contains(err.Error(), \"server_listener_resource_name_template\") {\n        // fix bootstrap JSON and retry; do not proceed to Serve\n    }\n}","preventionTips":["Always include a non-empty server_listener_resource_name_template in the bootstrap used for servers.","Keep separate bootstrap files for client-only vs server workloads, or ensure the shared one has both fields.","Regenerate bootstrap from your control plane with server fields enabled."],"tags":["grpc","xds","server","bootstrap","config","go"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}