{"record":{"id":"750575d93165ead2","repo":"temporalio/temporal","slug":"missingserviceinstatichosts","errorCode":"missingServiceInStaticHosts","errorMessage":"%w: %v","messagePattern":"%w: %v","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"temporal/fx.go","lineNumber":292,"sourceCode":"\t\t\tesHttpClient, err = esclient.NewAwsHttpClient(esConfig.AWSRequestSigning)\n\t\t\tif err != nil {\n\t\t\t\treturn serverOptionsProvider{}, fmt.Errorf(\"unable to create AWS HTTP client for Elasticsearch: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tesClient, err = esclient.NewClient(esConfig, esHttpClient, logger)\n\t\tif err != nil {\n\t\t\treturn serverOptionsProvider{}, fmt.Errorf(\"unable to create Elasticsearch client (URL = %v, username = %q): %w\",\n\t\t\t\tesConfig.URL.Redacted(), esConfig.Username, err)\n\t\t}\n\t}\n\n\t// check that when static hosts are defined, they are defined for all required hosts\n\tif len(so.hostsByService) > 0 {\n\t\tfor _, service := range DefaultServices {\n\t\t\thosts := so.hostsByService[primitives.ServiceName(service)]\n\t\t\tif len(hosts.All) == 0 {\n\t\t\t\treturn serverOptionsProvider{}, fmt.Errorf(\"%w: %v\", missingServiceInStaticHosts, service)\n\t\t\t}\n\t\t}\n\t}\n\n\tif so.config.Global.Authorization.RemoteClusterAuth.Require && so.tokenProvider == nil {\n\t\treturn serverOptionsProvider{}, errors.New(\"global.authorization.remoteClusterAuth.require is true but no TokenProvider is configured: use WithTokenProvider\")\n\t}\n\t// TokenCredentials require TLS (RFC 9700); without a remote-cluster TLS source the first\n\t// cross-cluster dial would fatal-log, with no clear \"you forgot TLS\" diagnostic.\n\t// Coarse check: any remote-cluster TLS entry passes; per-hostname config is still validated\n\t// lazily on first dial.\n\tif so.tokenProvider != nil && so.tlsConfigProvider == nil && len(so.config.Global.TLS.RemoteClusters) == 0 {\n\t\treturn serverOptionsProvider{}, errors.New(\"WithTokenProvider is set but no remote-cluster TLS is configured: supply global.tls.remoteClusters in config, or pass a provider via WithTLSConfigProvider\")\n\t}\n\n\treturn serverOptionsProvider{\n\t\tServerOptions:              so,\n\t\tStopChan:                   stopChan,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/temporal/fx.go#L274-L310","documentation":"Sentinel error missingServiceInStaticHosts wrapped with the offending service name. When static hosts are provided via WithHosts (hostsByService), every default service (frontend, history, matching, worker, etc.) must have at least one host entry; a missing entry aborts server construction.","triggerScenarios":"Calling WithHosts with a map that omits one of temporal.DefaultServices; any service name in the map has an empty hosts.All list.","commonSituations":"Adding a new Temporal service (e.g. internal-frontend) to DefaultServices but not updating the static host map in operator tooling or tests; copy-pasted host config that forgot one service.","solutions":["Add the missing service to the WithHosts map with at least one host","Reconcile the host map against temporal.DefaultServices programmatically","If static hosts are no longer needed, remove WithHosts and rely on default membership resolution"],"exampleFix":"// before\nopts := temporal.WithHosts(map[primitives.ServiceName]temporal.Hosts{\n  primitives.FrontendService: {All: []string{\"h1:7233\"}},\n  primitives.HistoryService:  {All: []string{\"h1:7234\"}},\n})\n// after\nopts := temporal.WithHosts(map[primitives.ServiceName]temporal.Hosts{\n  primitives.FrontendService: {All: []string{\"h1:7233\"}},\n  primitives.HistoryService:  {All: []string{\"h1:7234\"}},\n  primitives.MatchingService: {All: []string{\"h1:7235\"}},\n  primitives.WorkerService:   {All: []string{\"h1:7239\"}},\n})","handlingStrategy":"validation","validationCode":"for _, svc := range temporal.DefaultServices {\n    if len(hostsByService[svc].All) == 0 {\n        return fmt.Errorf(\"missing static hosts for %s\", svc)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Iterate temporal.DefaultServices (not a hand-written list) when building host maps","Add a unit test asserting every default service has hosts","Regenerate host maps when new Temporal services are introduced"],"tags":["configuration","static-hosts","startup"],"backgroundTag":"missing-service-host-config","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}