Terminating a unregistered workflow

Hi,

I have a use case in which I’m starting a workflow which is picked by a worker but not registered in that worker. I want to handle it by terminating / canceling the workflow but by design the workflow keeps running (waiting for another worker that might be deployed later on and pick it up).

Is there a best practice to handle such case ?

Thanks.

2025-01-22T09:59:28.204360Z WARN temporal_sdk_core::worker::workflow: Failing workflow task run_id=d9f036d0-b69e-4758-9b21-b283a97d7851 failure=Failure { failure: Some(Failure { message: “Workflow type MyWorkflow1234 is not registered on this worker, available workflows: MyChildWorkflow, MyWorkflow”, source: “”, stack_trace: " at Temporalio.Worker.WorkflowWorker.CreateInstance(WorkflowActivation act)\r\n at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)\r\n at Temporalio.Worker.WorkflowWorker.HandleActivationAsync(IPayloadCodec codec, WorkflowActivation act)", encoded_attributes: None, cause: None, failure_info: Some(ApplicationFailureInfo(ApplicationFailureInfo { r#type: “NotFoundError”, non_retryable: false, details: None, next_retry_delay: None })) }), force_cause: Unspecified }

You can use a DynamicWorkflow implementation that fails.

Thanks, will try.