{"record":{"id":"ca7357ec5e5cc7d8","repo":"temporalio/temporal","slug":"current-cluster-is-not-specified-in-cluster-info","errorCode":null,"errorMessage":"Current cluster is not specified in cluster info","messagePattern":"Current cluster is not specified in cluster info","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"common/cluster/metadata.go","lineNumber":161,"sourceCode":"\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\")\n\t}\n\n\tcopyClusterInfo := make(map[string]ClusterInformation)\n\tmaps.Copy(copyClusterInfo, clusterInfo)\n\tif refreshDuration == nil {\n\t\trefreshDuration = dynamicconfig.GetDurationPropertyFn(refreshInterval)\n\t}\n\treturn &metadataImpl{\n\t\tstatus:                   common.DaemonStatusInitialized,\n\t\tenableGlobalNamespace:    enableGlobalNamespace,\n\t\tfailoverVersionIncrement: failoverVersionIncrement,\n\t\tmasterClusterName:        masterClusterName,\n\t\tcurrentClusterName:       currentClusterName,\n\t\tclusterInfo:              copyClusterInfo,\n\t\tversionToClusterName:     versionToClusterName,","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/cluster/metadata.go#L143-L179","documentation":"NewMetadata requires that currentClusterName be a key in the clusterInfo map. If the current cluster is not listed among the configured clusters, the constructor panics because many operations (GetClusterID, replication decisions) look up clusterInfo[currentClusterName] and would otherwise fail later at runtime.","triggerScenarios":"cluster.NewMetadata(clusterInfoWithoutSelf, masterClusterName, \"myCluster\", ...) where \"myCluster\" is absent from the clusterInfo map keys.","commonSituations":"Config listing only remote clusters in clusterMetadata but omitting the local cluster; renaming the current cluster in one config section but not the other.","solutions":["Add an entry for the current cluster to clusterInfo with its InitialFailoverVersion and enabled flag","Verify the currentClusterName string matches a clusterInfo key exactly (case-sensitive)","Regenerate/align all cluster configs from a shared template so local and remote entries stay consistent"],"exampleFix":"// before\nclusterInfo := map[string]cluster.ClusterInformation{\"remote\": {InitialFailoverVersion: 1, IsEnabled: true}}\nmd := cluster.NewMetadata(clusterInfo, \"remote\", \"local\", 1, nil, nil)\n// after\nclusterInfo[\"local\"] = cluster.ClusterInformation{InitialFailoverVersion: 0, IsEnabled: true}\nmd := cluster.NewMetadata(clusterInfo, \"remote\", \"local\", 1, nil, nil)","handlingStrategy":"validation","validationCode":"if _, ok := clusterInfo[currentClusterName]; !ok {\n  return fmt.Errorf(\"current cluster %q missing from clusterInfo\", currentClusterName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the local cluster entry in every datacenter's clusterMetadata config","Cross-check currentClusterName against clusterInfo keys at config load time","Keep cluster name strings in shared constants, not inline literals"],"tags":["go","panic","configuration","multi-cluster"],"backgroundTag":"cluster-not-in-config","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}