Workflow versioning activity type not registered


I have added some new changes to our workflow and we added version logic as explained here: Versioning | Temporal Documentation

final var version = Workflow.getVersion("new_changes", Workflow.DEFAULT_VERSION, 1);
if (version == 1) {

We deployed the changes and in one of our workflows we found the next error:

java.lang.IllegalArgumentException: Activity Type "ExecuteNewActivity" is not registered with a worker. Known types are: Activity1, Activity2, Activity3.

That error was triggered by a worker with the old code, which does not have the activity registered, but I wasn’t expecting that the new activity would be picked from an old worker :sweat:

I guess this behavior makes sense, since the new worker would have push the new activity to the activity task queue and randomly it was picked by an old worker (there is a small race condition in which both workers are polling during a deployment), but my question is… can this be avoided somehow? Or should we just acknowledge the behavior and rely on the retries for that?

Regards, Diego.

If you have multiple workers polling the same task queue, it is random which one is going to pick up the activity task.
If a worker receives a task for an activity type that it doesn’t know about it rejects it by failing with “Activity type is not registered with the worker” exception. Server then reschedules this task and this will happen until a worker that has the activity registered picks it up. So yes, you might experience this until all your workers have all activities registered.

Are the multiple workers that poll on this task queue in different processes?

One possible solution is to use a separate task queue for each worker type. With this only activities that the worker supports will be dispatched to it. You would set task queue in your Activity options for each activity type, for example:


or set per-activity options via WorkflowImplementationOptions.