# Unexpected error when using worker replay

**URL:** <https://community.temporal.io/t/unexpected-error-when-using-worker-replay/10595>\
**Category:** Community Support\
**Tags:** worker, typescript-sdk, replay\
**Created:** [January 8, 2024, 11:22am UTC](https://community.temporal.io/t/unexpected-error-when-using-worker-replay/10595 "2024-01-08T11:22:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishore\_kumar](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/kishore_kumar/32/4015_2.png) [@kishore\_kumar](https://community.temporal.io/u/kishore_kumar)\
**Post date:** [January 8, 2024, 11:22am UTC](https://community.temporal.io/t/unexpected-error-when-using-worker-replay/10595/1 "2024-01-08T11:22:41Z")

</div>

Hi Guys I’m using Worker.runReplayHistories functionality provided by the temporal, as per this documentation,

> **[TypeScript SDK developer's guide - Testing | Temporal Documentation](https://docs.temporal.io/dev-guide/typescript/testing#replay)**
>
> The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution,...

But I’m getting the following error at the end, In the following way at Worker.runReplayHistories… any specific reason?

TypeError: Expected a non-null history object, got undefined  
at Function.validateHistory (C:\Users\BHAVANAK\workflow-service\sap-broker\node\_modules@temporalio\worker\lib\worker.js:293:19)  
at Function.runReplayHistories (C:\Users\BHAVANAK\workflow-service\sap-broker\node\_modules@temporalio\worker\lib\worker.js:238:44)  
at async run (C:\Users\BHAVANAK\workflow-service\sap-broker\src\worker\worker.ts:76:92)

---

<div class="post-metadata">

**Author:** ![bergundy](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bergundy/32/900_2.png) [@bergundy](https://community.temporal.io/u/bergundy)\
**Post date:** [January 18, 2024, 11:52pm UTC](https://community.temporal.io/t/unexpected-error-when-using-worker-replay/10595/2 "2024-01-18T23:52:22Z")

</div>

Can you provide the code so we can figure out where the undefined value is coming from?
