Reset workflow to a particuylar event ID

Hi,

I was trying to reset workflow to particular event id using the tctl command as pointed here but it was throwing me:

rpc error: code = InvalidArgument desc = nDCStateRebuilder unable to rebuild mutable state to event ID: 260, version: 0, this event must be at the boundary

The event ID I used is that of WorkflowTaskCompleted event. Could I get an example of how to reset a workflow to a prticular even ID ?

The reset functionality is somewhat limited at the moment. It supports resetting to “WorkflowTaskStarted” event ids only.

Not sure which SDK you use, but here is a util method for Java SDK that you can use as an example:

1 Like

Hey tihomir,

Thanks for replying. We are using tctl v1.9.1, we are not resetting it via codebase, we are running the tctl command directly, Tried for WorkflowTaskStarted event as well, still getting the same issue.

Can you show your workflow history and the tctl command you are running?
Just tried locally and was able to reset a failed workflow with:

tctl workflow reset -w myWorkflow -r ac4d8846-507b-4460-b178-24538b772d76 --event_id 9 --reason "some_reason"

where event 9 is a “WorkflowTaskStarted” event.
Another question, did you fix the workflow definition and restart the worker before trying to reset?Otherwise your workflow will still run in the same issue as before the reset attempt.

Is it mandatory to restart the worker before reset? If I restart worker before reset I got this error
thread 'tokio-runtime-worker' panicked at 'Workflow machines must exist, we just created/updated them: WorkflowMissingError { run_id: "e51b8b04-016e-45e1-8fb2-bd789a925d49" }', sdk-core\src\workflow\workflow_tasks\mod.rs:304:14

I am facing issue with workflow reset. I am using this tctl command
tctl workflow reset -w 27ffe419-9701-415d-acb5-de234ad44668 --event_id 3 --reason 'reset'
In temporal ui history it shows workflow reset with new run id. But my workflow code didn’t execute actually. It just updated history. Please check attachment


Source activity failed for some reason. My expectation, if I reset , this workflow should be failed by executing it’s old workflow code.