temporalio/temporal · error

unknown workflow state sync result: %d

Error message

unknown workflow state sync result: %d

What it means

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.

Source

Thrown at service/history/api/verifyfirstworkflowtaskscheduled/api.go:267

		},
	)
	if err != nil {
		emitResult(wideevents.ParentChildOutcomeFailed, err, "sync_workflow_state")
		return err
	}
	switch result {
	case workflowresend.SyncWorkflowStateResultSourceNotFound:
		emitResult(
			wideevents.ParentChildOutcomeSourceNotFound,
			serviceerror.NewNotFound("child workflow not found on source cluster"),
			"sync_workflow_state",
		)
		return nil
	case workflowresend.SyncWorkflowStateResultSkipped:
		return errVerify
	case workflowresend.SyncWorkflowStateResultApplied:
	default:
		return fmt.Errorf("unknown workflow state sync result: %d", result)
	}

	_, _, _, err = verifyFirstWorkflowTaskScheduled(ctx, req, workflowConsistencyChecker)
	if err != nil {
		emitResult(wideevents.ParentChildOutcomeFailed, err, "verify_after_resend")
		return err
	}
	emitResult(wideevents.ParentChildOutcomeSucceeded, nil, "")
	return nil
}

func childResendEventDetails(initialError error) map[string]any {
	return map[string]any{
		"initial_error_type": util.ErrorType(initialError),
	}
}

func emitChildResendLifecycleEvent(

View on GitHub (pinned to bde624efd1)

Solutions

  1. Update the switch in resendChildAndVerify (service/history/api/verifyfirstworkflowtaskscheduled/api.go) to handle every SyncWorkflowStateResult enum member
  2. Check that the workflowresend package's enum and the consuming switch are from the same build; redeploy both services from a consistent version
  3. Add a default-case test covering all enum values so new members fail compilation or tests, not runtime

Example fix

// before
case workflowresend.SyncWorkflowStateResultApplied:
default:
	return fmt.Errorf("unknown workflow state sync result: %d", result)
// after
case workflowresend.SyncWorkflowStateResultApplied:
case workflowresend.SyncWorkflowStateResultNewValue:
	// handle the new result
default:
	return fmt.Errorf("unknown workflow state sync result: %d", result)
Defensive patterns

Strategy: try-catch

Try / catch

result, err := resendChildAndVerify(ctx, req)
if err != nil {
	var unk *fmt.Errorf // unknown result sentinel
	if strings.Contains(err.Error(), "unknown workflow state sync result") {
		// treat as invariant violation: alert and fail the operation
	}
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


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