Error in workflow after a long await


I have a workflow set up running with a while true loop within it having 4 activities and an await() state.
if the await state is small like around 5 min, the workflow is executed properly every 5 min .

But when the await() is longer like 15hr after some time like 10hr below error is thrown in the slacktrace

  1. What are the possible scenarios that this error can be thrown
  2. If anyone else faced with this error, how is this resolved

3 INVALID_ARGUMENT: io.temporal.internal.replay.InternalWorkflowTaskException: Failure handling event 28 of 'EVENT_TYPE_TIMER_STARTED' type. IsReplaying=true, PreviousStartedEventId=26, workflowTaskStartedEventId=0, Currently Processing StartedEventId=26 at io.temporal.internal.statemachines.WorkflowStateMachines.handleEvent( at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleEvent( at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTaskImpl( at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleQueryWorkflowTask( at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleQueryOnlyWorkflowTask( at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask( at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle( at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle( at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0( at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at Caused by: java.lang.IllegalStateException: Event 28 of EVENT_TYPE_TIMER_STARTED does not match command COMMAND_TYPE_SCHEDULE_ACTIVITY_TASK at io.temporal.internal.statemachines.WorkflowStateMachines.handleCommandEvent( at io.temporal.internal.statemachines.WorkflowStateMachines.handleEventImpl( at io.temporal.internal.statemachines.WorkflowStateMachines.handleEvent( ... 11 more

What is the Java SDK version?
Was the code updated during the 10 hour window?
If you could share code and post the event history (or DM me directly) it would also help.

The problem was in breaking determinism by using DateUtils.getCurrTime() which in turn called

According to Workflow Implementation Constraints only time returned by Workflow.currentTimeMillis can be used inside the workflow code.