temporalio/temporal · error

hosts are missing in static hosts for service: ${service}

Error message

hosts are missing in static hosts for service: ${service}

What it means

missingServiceInStaticHosts is a prefix error wrapped with the service name when a service listed in the cluster's membership configuration cannot be found in the staticHosts map. The server requires every service to resolve to a host:port when using static (non-membership) resolution.

Source

Thrown at temporal/fx.go:70

	"go.temporal.io/server/common/telemetry"
	"go.temporal.io/server/common/testing/testhooks"
	"go.temporal.io/server/common/wideevents"
	"go.temporal.io/server/service/frontend"
	"go.temporal.io/server/service/history"
	"go.temporal.io/server/service/history/replication"
	"go.temporal.io/server/service/history/tasks"
	"go.temporal.io/server/service/matching"
	"go.temporal.io/server/service/worker"
	"go.uber.org/fx"
	"go.uber.org/fx/fxevent"
	expmaps "golang.org/x/exp/maps"
	"google.golang.org/grpc"
)

var (
	clusterMetadataInitErr           = errors.New("failed to initialize current cluster metadata")
	missingCurrentClusterMetadataErr = errors.New("missing current cluster metadata under clusterMetadata.ClusterInformation")
	missingServiceInStaticHosts      = errors.New("hosts are missing in static hosts for service: ")
)

type (
	ServicesGroupOut struct {
		fx.Out
		Services *ServicesMetadata `group:"services"`
	}

	ServicesGroupIn struct {
		fx.In
		Services []*ServicesMetadata `group:"services"`
	}

	ServicesMetadata struct {
		app         *fx.App
		serviceName primitives.ServiceName
		logger      log.Logger
	}

View on GitHub (pinned to bde624efd1)

Solutions

  1. Add the missing service to the staticHosts map with its host:port
  2. Remove the stray service from config if it is not meant to run
  3. If using dynamic membership, fix config so static host resolution is not selected (or supply hashring/static hosts consistently)
  4. Check for typos between service names in services list and staticHosts keys

Example fix

// before
staticHosts:
  frontend: "127.0.0.1:7233"
  history: "127.0.0.1:7234"
  matching: "127.0.0.1:7235"
# config references service: worker
// after
staticHosts:
  frontend: "127.0.0.1:7233"
  history: "127.0.0.1:7234"
  matching: "127.0.0.1:7235"
  worker: "127.0.0.1:7239"
Defensive patterns

Strategy: validation

Validate before calling

func validateStaticHosts(cfg *config.Config, services []string) error {
    for _, s := range services {
        if _, ok := cfg.Global.Membership.FrontendHosts /* or relevant staticHosts map */ [s]; !ok {
            return fmt.Errorf("service %q missing from staticHosts", s)
        }
    }
    return nil
}

Type guard

func staticHostDefined(hosts map[string]string, service string) bool {
    _, ok := hosts[service]
    return ok
}

Try / catch

if err := server.Start(); err != nil {
    if strings.Contains(err.Error(), "hosts are missing in static hosts for service") {
        log.Fatalf("add the named service to staticHosts in config")
    }
    return err
}

Prevention

When it happens

Trigger: Starting temporal server with global/membership configured to use static hosts (p2p/static resolution) while the config's services list or cross-service references include a service (e.g. "worker", "bifrost") absent from the staticHosts section.

Common situations: Adding a new service to config without updating static hosts; typo in service name; running with a multi-service config file but static host list copied from a single-service template; disabling membership/ringpop without defining all hosts.

Related errors


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/78915bd2e5391115. Report an issue: GitHub.