{"record":{"id":"211d17d1e7bdf8d2","repo":"temporalio/temporal","slug":"empty-cluster-information","errorCode":null,"errorMessage":"Empty cluster information","messagePattern":"Empty cluster information","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"common/cluster/metadata.go","lineNumber":146,"sourceCode":"\t\tversionToClusterName map[int64]string\n\n\t\tclusterCallbackLock   sync.RWMutex\n\t\tclusterChangeCallback map[any]CallbackFn\n\t}\n)\n\nfunc NewMetadata(\n\tenableGlobalNamespace bool,\n\tfailoverVersionIncrement int64,\n\tmasterClusterName string,\n\tcurrentClusterName string,\n\tclusterInfo map[string]ClusterInformation,\n\tclusterMetadataStore persistence.ClusterMetadataManager,\n\trefreshDuration dynamicconfig.DurationPropertyFn,\n\tlogger log.Logger,\n) Metadata {\n\tif len(clusterInfo) == 0 {\n\t\tpanic(\"Empty cluster information\")\n\t} else if len(masterClusterName) == 0 {\n\t\tpanic(\"Master cluster name is empty\")\n\t} else if len(currentClusterName) == 0 {\n\t\tpanic(\"Current cluster name is empty\")\n\t} else if failoverVersionIncrement == 0 || failoverVersionIncrement > math.MaxInt32 {\n\t\tpanic(\"Version increment <= 0 or > 2147483647\")\n\t}\n\n\tversionToClusterName, err := updateVersionToClusterName(clusterInfo, failoverVersionIncrement)\n\tif err != nil {\n\t\t// nolint:forbidigo // matches the other startup-config panics in this constructor\n\t\tpanic(err.Error())\n\t}\n\tif _, ok := clusterInfo[currentClusterName]; !ok {\n\t\tpanic(\"Current cluster is not specified in cluster info\")\n\t}\n\tif _, ok := clusterInfo[masterClusterName]; !ok {\n\t\tpanic(\"Master cluster is not specified in cluster info\")","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/cluster/metadata.go#L128-L164","documentation":"NewMetadata in common/cluster/metadata.go validates its inputs at construction and panics with \"Empty cluster information\" when the provided clusterInfo map has no entries. Cluster metadata needs at least the current (and master) cluster defined; an empty map means the service cannot reason about replication at all, so it fails fast at startup.","triggerScenarios":"Calling NewMetadata with clusterInfo == nil or an empty map — e.g. an empty `clusters:` section in the config, all clusters filtered out by env-specific config loading, or a config struct that failed to populate.","commonSituations":"Frontend/history service config missing the `system.clusterInformation`/clusters block; misread or wrong config file path yielding defaults; config parsing that silently drops entries with bad keys; automated config generation producing an empty cluster list.","solutions":["Add at least the current cluster (and all replication clusters) to the clusterInfo passed to NewMetadata","Verify the config file actually contains the clusters section and is being loaded from the right path","Validate cluster config presence in a pre-start check before constructing metadata","Check env-specific config overrides are not blanking out the clusters list"],"exampleFix":"// before (config.yaml)\nclusterMetadata:\n  enableGlobalDomain: true\n  # clusters section missing\n// after (config.yaml)\nclusterMetadata:\n  enableGlobalDomain: true\n  clusters:\n    - clusterName: active\n      clusterAddress: \"127.0.0.1:7233\"\n      failoverVersionIncrement: 10\n      initialFailoverVersion: 0\n","handlingStrategy":"validation","validationCode":"if len(clusterInfo) == 0 {\n    return errors.New(\"config error: clusterInformation must define at least one cluster\")\n}","typeGuard":"func hasClusters(info map[string]cluster.ClusterInformation) bool { return len(info) > 0 }","tryCatchPattern":null,"preventionTips":["Validate the clusters section exists in the loaded config before constructing metadata","Log the config source path at startup to catch wrong-file loads","Keep a default single-cluster config as a fallback","Check env-specific overrides for blanked cluster lists"],"tags":["cluster","config","panic","startup","replication"],"backgroundTag":"empty-cluster-config","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}