{"record":{"id":"e5b5d8ca668f030d","repo":"temporalio/temporal","slug":"unknown-workflow-state-sync-result-d-e5b5d8","errorCode":null,"errorMessage":"unknown workflow state sync result: %d","messagePattern":"unknown workflow state sync result: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/api/verifyfirstworkflowtaskscheduled/api.go","lineNumber":267,"sourceCode":"\t\t},\n\t)\n\tif err != nil {\n\t\temitResult(wideevents.ParentChildOutcomeFailed, err, \"sync_workflow_state\")\n\t\treturn err\n\t}\n\tswitch result {\n\tcase workflowresend.SyncWorkflowStateResultSourceNotFound:\n\t\temitResult(\n\t\t\twideevents.ParentChildOutcomeSourceNotFound,\n\t\t\tserviceerror.NewNotFound(\"child workflow not found on source cluster\"),\n\t\t\t\"sync_workflow_state\",\n\t\t)\n\t\treturn nil\n\tcase workflowresend.SyncWorkflowStateResultSkipped:\n\t\treturn errVerify\n\tcase workflowresend.SyncWorkflowStateResultApplied:\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown workflow state sync result: %d\", result)\n\t}\n\n\t_, _, _, err = verifyFirstWorkflowTaskScheduled(ctx, req, workflowConsistencyChecker)\n\tif err != nil {\n\t\temitResult(wideevents.ParentChildOutcomeFailed, err, \"verify_after_resend\")\n\t\treturn err\n\t}\n\temitResult(wideevents.ParentChildOutcomeSucceeded, nil, \"\")\n\treturn nil\n}\n\nfunc childResendEventDetails(initialError error) map[string]any {\n\treturn map[string]any{\n\t\t\"initial_error_type\": util.ErrorType(initialError),\n\t}\n}\n\nfunc emitChildResendLifecycleEvent(","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/api/verifyfirstworkflowtaskscheduled/api.go#L249-L285","documentation":"verifyFirstWorkflowTaskScheduled handling in the history service reaches an unknown sentinel value for a workflow state sync result. The enum workflowresend.SyncWorkflowStateResult only defines Skipped and Applied; any other value means a new enum member was added without updating the switch in resendChildAndVerify. It is an internal invariant violation, not a user error.","triggerScenarios":"resendChildAndVerify receives a result value from a workflowresend sync-workflow-state call that is neither SyncWorkflowStateResultSkipped nor SyncWorkflowStateResultApplied — e.g. after a new result type is added to the enum but the switch statement is not extended.","commonSituations":"Version skew between binaries during a rolling deploy where one binary emits a new SyncWorkflowStateResult value; custom forks that extend the enum; accidental corruption of the result value in transit (very unlikely since it is an in-process return value).","solutions":["Update the switch in resendChildAndVerify (service/history/api/verifyfirstworkflowtaskscheduled/api.go) to handle every SyncWorkflowStateResult enum member","Check that the workflowresend package's enum and the consuming switch are from the same build; redeploy both services from a consistent version","Add a default-case test covering all enum values so new members fail compilation or tests, not runtime"],"exampleFix":"// before\ncase workflowresend.SyncWorkflowStateResultApplied:\ndefault:\n\treturn fmt.Errorf(\"unknown workflow state sync result: %d\", result)\n// after\ncase workflowresend.SyncWorkflowStateResultApplied:\ncase workflowresend.SyncWorkflowStateResultNewValue:\n\t// handle the new result\ndefault:\n\treturn fmt.Errorf(\"unknown workflow state sync result: %d\", result)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"result, err := resendChildAndVerify(ctx, req)\nif err != nil {\n\tvar unk *fmt.Errorf // unknown result sentinel\n\tif strings.Contains(err.Error(), \"unknown workflow state sync result\") {\n\t\t// treat as invariant violation: alert and fail the operation\n\t}\n\treturn err\n}","preventionTips":["Keep switch statements over enums exhaustive (use exhaustive linter)","Add tests enumerating all SyncWorkflowStateResult values","Deploy all services from the same build to avoid enum version skew"],"tags":["go","history-service","internal-invariant","enum"],"backgroundTag":"unhandled-enum-value","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}