# Worker tries to pick up wrong flow

**URL:** <https://community.temporal.io/t/worker-tries-to-pick-up-wrong-flow/10184>\
**Category:** Community Support\
**Tags:** java-sdk, namespace, workflow-implementat\
**Created:** [November 24, 2023, 1:43pm UTC](https://community.temporal.io/t/worker-tries-to-pick-up-wrong-flow/10184 "2023-11-24T13:43:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WvdL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/wvdl/32/4660_2.png) [@WvdL](https://community.temporal.io/u/WvdL)\
**Post date:** [November 24, 2023, 1:43pm UTC](https://community.temporal.io/t/worker-tries-to-pick-up-wrong-flow/10184/1 "2023-11-24T13:43:18Z")

</div>

Hi,

Im in the situation that a workers keeps polling a ‘wrong’ flow.  
Both are on same namespace, how to avoid/fix this?

```auto
WorkflowClientOptions.newBuilder()
                .setNamespace(NAMESPACE_MANUAL_TASKS)
                .build();

```

**Application: DOG**  
worker config:

```auto
        Worker worker = factory.newWorker(DRIVER_TASK_QUEUE);

        worker.registerWorkflowImplementationTypes(DetermineDriverWorkflowImpl.class);
        worker.registerActivitiesImplementations(determineDriverActivities.toArray()); 

```

**Application: MASS**  
worker config

```auto
        Worker worker = factory.newWorker(MANUAL_TASK_QUEUE);

        worker.registerWorkflowImplementationTypes(ManualTaskWorkFlowImpl.class);
        worker.registerActivitiesImplementations(manualTaskActivities.toArray());

```

**Application: MASS log**

```auto
WARN 147944 --- [ANUAL_FLOWS": 1] i.t.i.replay.ReplayWorkflowTaskHandler : Workflow task processing failure. startedEventId=6, WorkflowId=DRIVER-ea04e67f-1b2c-4659-ae6e-783369a71018, RunId=8c681a01-cbc4-4b44-ac3e-fcbd9eaeee4d. If seen continuously the workflow might be stuck.

java.lang.Error: Unknown workflow type "DetermineDriverWorkflow". Known types are [ManualTaskWorkFlow]
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory.getWorkflowDefinition(POJOWorkflowImplementationFactory.java:240) ~[temporal-sdk-1.20.1.jar:na]

```

---

<div class="post-metadata">

**Author:** ![antonio.perez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/antonio.perez/32/2417_2.png) [@antonio.perez](https://community.temporal.io/u/antonio.perez)\
**Post date:** [November 24, 2023, 3:08pm UTC](https://community.temporal.io/t/worker-tries-to-pick-up-wrong-flow/10184/3 "2023-11-24T15:08:19Z")

</div>

Hello

Make sure the taskqueue you schedule (start) the workflow and the one used in the factory to create the worker are the same. And that you register the implementation of the workflow execution in the worker

I guess you have to register DetermineDriverWorkflowImpl.class in **Application: MASS**

When you create the workflowStub, you set the taskqueue, something like:

```auto

IGreetingWorkflow workflow = client.newWorkflowStub(wfClass, WorkflowOptions.newBuilder()
                        .setTaskQueue("MyTaskqueue")
                        .build());

```

Workflow taks for this workflow execution with be added to “MyTaskqueue” (workflow queueue in the server)

When you create the worker, you have to specify the workflow task the worker will be polling tasks from:

` Worker worker = factory.newWorker("MyTaskqueue");`

and register the workflows and/or activities implementation:

```auto
        worker.registerWorkflowImplementationTypes(HelloActivity.GreetingWorkflowImpl.class);
        worker.registerActivitiesImplementations(new HelloActivity.GreetingActivitiesImpl());

```

I think either you are scheduling the workflow in the wrong taskqueue or you are missing registering the workflow implementation in the worker.

Antonio

---

<div class="post-metadata">

**Author:** ![WvdL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/wvdl/32/4660_2.png) [@WvdL](https://community.temporal.io/u/WvdL)\
**Post date:** [November 26, 2023, 2:31pm UTC](https://community.temporal.io/t/worker-tries-to-pick-up-wrong-flow/10184/4 "2023-11-26T14:31:23Z")

</div>

It was indeed the parent flow that was creating the flow for the wrong Queue. Was mainly focusing on the both child applications/flows.

Thanks, @antonio.perez for the pointer
