With the code provided it fails with this in debug mode (the other exception above in the normal run):
error=io.temporal.internal.replay.InternalWorkflowTaskException: Failure handling event 4 of type ‘EVENT_TYPE_WORKFLOW_TASK_COMPLETED’ during replay. {PreviousStartedEventId=3, workflowTaskStartedEventId=9223372036854775807, Currently Processing StartedEventId=3}
Whenever I try to change it starts to fail with the above, sometimes different exceptions as well(