# History is out of order error

**URL:** <https://community.temporal.io/t/history-is-out-of-order-error/9208>\
**Category:** Community Support\
**Created:** [August 16, 2023, 10:44am UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208 "2023-08-16T10:44:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monikongkona](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/monikongkona/32/1919_2.png) [@Monikongkona](https://community.temporal.io/u/Monikongkona)\
**Post date:** [August 16, 2023, 10:44am UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/1 "2023-08-16T10:44:35Z")

</div>

Hi,

I have multiple workflows running on production. Few of my workflows are failing with below error.  
Any pointers to debug?

{  
“message”: “History is out of order. There is a gap between the last event workflow state machine observed and currently handling event. Last processed eventId: 52, handling eventId: 107”,  
“source”: “JavaSDK”,  
“stackTrace”: “com.google.common.base.Preconditions.checkState(Preconditions.java:749)\nio.temporal.internal.statemachines.WorkflowStateMachines.handleEvent(WorkflowStateMachines.java:197)\nio.temporal.internal.replay.ReplayWorkflowRunTaskHandler.applyServerHistory(ReplayWorkflowRunTaskHandler.java:208)\nio.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTaskImpl(ReplayWorkflowRunTaskHandler.java:192)\nio.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTask(ReplayWorkflowRunTaskHandler.java:147)\nio.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithQuery(ReplayWorkflowTaskHandler.java:132)\nio.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:97)\nio.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handleTask(WorkflowWorker.java:336)\nio.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:246)\nio.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:188)\nio.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:93)\njava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\njava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\njava.lang.Thread.run(Thread.java:750)\n”,  
“encodedAttributes”: null,  
“cause”: null,  
“applicationFailureInfo”: {  
“type”: “java.lang.IllegalStateException”,  
“nonRetryable”: false,  
“details”: null  
}  
}

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 16, 2023, 4:54pm UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/3 "2023-08-16T16:54:04Z")

</div>

Would you check if these workflows are indeed failing or if this is just an intermittent message a worker logged?

---

<div class="post-metadata">

**Author:** ![Monikongkona](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/monikongkona/32/1919_2.png) [@Monikongkona](https://community.temporal.io/u/Monikongkona)\
**Post date:** [August 17, 2023, 3:22am UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/4 "2023-08-17T03:22:09Z")

</div>

yes workflow failed

 ![image](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/f/f882ae3849c2fbaeacf4dfe8394bd79e7ddea304.png)

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 17, 2023, 9:28pm UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/5 "2023-08-17T21:28:24Z")

</div>

Did you configure the workflow to fail on any unexpected exception?

---

<div class="post-metadata">

**Author:** ![Monikongkona](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/monikongkona/32/1919_2.png) [@Monikongkona](https://community.temporal.io/u/Monikongkona)\
**Post date:** [August 18, 2023, 3:33am UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/6 "2023-08-18T03:33:29Z")

</div>

no @maxim thats my confusion as well why did temporal retry , default retry is 48 hours right

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 18, 2023, 4:35pm UTC](https://community.temporal.io/t/history-is-out-of-order-error/9208/7 "2023-08-18T16:35:12Z")

</div>

What do you mean by “did temporal retry”? You said that the workflow had failed.
