{"record":{"id":"c53fd752fa9f758c","repo":"temporalio/temporal","slug":"current-cluster-q-is-missing-from-cluster-metadat","errorCode":null,"errorMessage":"current cluster %q is missing from cluster metadata","messagePattern":"current cluster %q is missing from cluster metadata","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/api/workflowresend/sync_workflow_state.go","lineNumber":60,"sourceCode":"\tcurrentClusterName := clusterMetadata.GetCurrentClusterName()\n\tnamespaceRegistry := shardContext.GetNamespaceRegistry()\n\tnamespaceEntry, err := namespaceRegistry.GetNamespaceByID(namespaceID)\n\tif err != nil {\n\t\treturn SyncWorkflowStateResultSkipped, err\n\t}\n\tif !namespaceEntry.IsOnCluster(currentClusterName) {\n\t\treturn SyncWorkflowStateResultSkipped, nil\n\t}\n\n\troutingKey := namespace.RoutingKey{ID: execution.GetWorkflowId()}\n\tactiveClusterName := namespaceEntry.ActiveClusterName(routingKey)\n\tif activeClusterName == currentClusterName {\n\t\treturn SyncWorkflowStateResultSkipped, nil\n\t}\n\n\ttargetClusterInfo, ok := clusterMetadata.GetAllClusterInfo()[currentClusterName]\n\tif !ok {\n\t\treturn SyncWorkflowStateResultSkipped, fmt.Errorf(\"current cluster %q is missing from cluster metadata\", currentClusterName)\n\t}\n\tremoteAdminClient, err := shardContext.GetRemoteAdminClient(activeClusterName)\n\tif err != nil {\n\t\treturn SyncWorkflowStateResultSkipped, err\n\t}\n\tif onSourceResolved != nil {\n\t\tonSourceResolved(activeClusterName)\n\t}\n\n\tresp, err := remoteAdminClient.SyncWorkflowState(ctx, &adminservice.SyncWorkflowStateRequest{\n\t\tNamespaceId:         namespaceID.String(),\n\t\tExecution:           execution,\n\t\tArchetypeId:         chasm.WorkflowArchetypeID,\n\t\tVersionedTransition: versionedTransition,\n\t\tVersionHistories:    versionHistories,\n\t\tTargetClusterId:     int32(targetClusterInfo.InitialFailoverVersion),\n\t})\n\tif err != nil {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/api/workflowresend/sync_workflow_state.go#L42-L78","documentation":"SyncWorkflowStateFromSource resolves the current cluster's metadata before pulling workflow state from the active cluster. If the current cluster's name cannot be found in the cluster metadata map, the cluster is misconfigured. It returns SyncWorkflowStateResultSkipped along with this error so the caller's verification flow still records the failure.","triggerScenarios":"SyncWorkflowStateFromSource is called (from resendParentAndVerify, resendChildAndVerify, or sync CLI) on a cluster whose currentClusterName, obtained from clusterMetadata, is absent from the map returned by clusterMetadata.GetAllClusterInfo().","commonSituations":"Cluster name changed in config but metadata persistence was not updated; new cluster added without registering it in the cluster metadata table; replication/metadata store lag or corruption after failover; typo in currentClusterName configuration.","solutions":["Verify the cluster's currentClusterName (config + clusterMetadata) matches an entry registered via cluster metadata initialization / UpdateClusterInfo","Check the metadata persistence backend (e.g. the clusters table in the visibility DB) contains the current cluster's name and the config points at the right DB","If this is a standby cluster being registered, ensure the cluster is added to all peers' cluster metadata before running workflow resends"],"exampleFix":"// before\n// clusterName in config: \"clusterA\" but metadata only has \"cluster-a\"\n// after\n// align config currentClusterName with the registered metadata entry\n// or register it:\n// err := metadataInitializer.UpdateClusterInfo(name, clusterInfo)","handlingStrategy":"validation","validationCode":"info, ok := clusterMetadata.GetAllClusterInfo()[currentClusterName]\nif !ok {\n\treturn fmt.Errorf(\"cluster %q not registered in metadata\", currentClusterName)\n}","typeGuard":null,"tryCatchPattern":"result, err := syncWorkflowStateFromSource(ctx)\nif err != nil && strings.Contains(err.Error(), \"missing from cluster metadata\") {\n\t// abort operation; fix cluster registration before retrying\n}","preventionTips":["Register every cluster in metadata before enabling replication/resend features","Keep currentClusterName config in sync with metadata persistence","Add a startup health check asserting current cluster exists in GetAllClusterInfo"],"tags":["go","multi-cluster","cluster-metadata","configuration"],"backgroundTag":"cluster-metadata-missing","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}