From e1fc08514c75cf63189819aef30bf270ae6444cd Mon Sep 17 00:00:00 2001 From: Duncan Mackenzie Date: Mon, 30 Nov 2026 11:18:28 -0800 Subject: [PATCH 1/3] Correct what happens to an Update when the Workflow closes The docs said an Update arriving during a closing Workflow Task fails the task with Unhandled Update. The server has that check commented out: Updates don't block a Workflow from closing. Document the actual outcomes: NOT_FOUND for an unaccepted Update when the run closes, a retryable busy Workflow error when it continues as new, and an AcceptedUpdateCompletedWorkflow Update failure for an accepted Update whose handler hasn't finished. The SDK message-passing pages still described the pre-GA "workflow execution already completed" / NOT_FOUND error for that last case. --- docs/develop/dotnet/workflows/message-passing.mdx | 3 +-- docs/develop/go/workflows/message-passing.mdx | 3 +-- docs/develop/java/workflows/message-passing.mdx | 3 +-- docs/develop/php/workflows/message-passing.mdx | 2 +- docs/develop/python/workflows/message-passing.mdx | 2 +- docs/develop/ruby/workflows/message-passing.mdx | 3 +-- .../typescript/workflows/message-passing.mdx | 2 +- .../handling-messages.mdx | 15 ++++++++++++--- docs/references/workflow-task-errors.mdx | 12 ++++++------ docs/troubleshooting/request-failures.mdx | 4 ++-- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/docs/develop/dotnet/workflows/message-passing.mdx b/docs/develop/dotnet/workflows/message-passing.mdx index 0bb8a9e9d0..dcd60555ef 100644 --- a/docs/develop/dotnet/workflows/message-passing.mdx +++ b/docs/develop/dotnet/workflows/message-passing.mdx @@ -698,8 +698,7 @@ When working with Updates, you may encounter these errors: Once the Workflow is healthy again after a code deploy, use an [`UpdateHandle`](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowUpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) "workflow execution already completed". - + You'll receive a [`Temporalio.Exceptions.WorkflowUpdateFailedException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.WorkflowUpdateFailedException.html) whose inner exception is an `ApplicationFailureException` of type `AcceptedUpdateCompletedWorkflow`. This will happen if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/go/workflows/message-passing.mdx b/docs/develop/go/workflows/message-passing.mdx index 5436ae2168..134de87849 100644 --- a/docs/develop/go/workflows/message-passing.mdx +++ b/docs/develop/go/workflows/message-passing.mdx @@ -751,8 +751,7 @@ If an issue occurs during the handler execution by the Worker, the Client may re Once the Workflow is healthy again after a code deploy, use a [`WorkflowUpdateHandle`](https://pkg.go.dev/go.temporal.io/sdk/client#WorkflowUpdateHandle) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`ServiceError`](https://pkg.go.dev/go.temporal.io/api/serviceerror#ServiceError) "workflow execution already completed"`. - + The Update returns a [`temporal.ApplicationError`](https://pkg.go.dev/go.temporal.io/sdk/temporal#ApplicationError) whose type is `AcceptedUpdateCompletedWorkflow`. This will happen if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/java/workflows/message-passing.mdx b/docs/develop/java/workflows/message-passing.mdx index bf19376046..6fd3e50bc2 100644 --- a/docs/develop/java/workflows/message-passing.mdx +++ b/docs/develop/java/workflows/message-passing.mdx @@ -796,8 +796,7 @@ When working with Updates, you may encounter these errors: Once the Workflow is healthy again after a code deploy, use a [`WorkflowUpdateHandle`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowUpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`WorkflowServiceException`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowServiceException.html) "workflow execution already completed"`. - + You'll receive a `WorkflowUpdateException` whose cause is an `ApplicationFailure` of type `AcceptedUpdateCompletedWorkflow`. This will happen if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/php/workflows/message-passing.mdx b/docs/develop/php/workflows/message-passing.mdx index b46bce2262..4d901f16fa 100644 --- a/docs/develop/php/workflows/message-passing.mdx +++ b/docs/develop/php/workflows/message-passing.mdx @@ -932,7 +932,7 @@ These might include: Once the Workflow is healthy again after a code deploy, use an [`UpdateHandle`](https://php.temporal.io/classes/Temporal-Client-Update-UpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`WorkflowUpdateException`](https://php.temporal.io/classes/Temporal-Exception-Client-WorkflowUpdateException.html). + You'll receive a [`WorkflowUpdateException`](https://php.temporal.io/classes/Temporal-Exception-Client-WorkflowUpdateException.html) whose previous exception is an `ApplicationFailure` of type `AcceptedUpdateCompletedWorkflow`. This happens if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/python/workflows/message-passing.mdx b/docs/develop/python/workflows/message-passing.mdx index 251c1aadc1..1c11fd0aef 100644 --- a/docs/develop/python/workflows/message-passing.mdx +++ b/docs/develop/python/workflows/message-passing.mdx @@ -765,7 +765,7 @@ When working with Updates, in addition to the `RPCError`s described above, you m Once the Workflow is healthy again after a code deploy, use an [`UpdateHandle`](https://python.temporal.io/temporalio.client.WorkflowUpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`temporalio.service.RPCError`](https://python.temporal.io/temporalio.service.RPCError.html) exception with a `status` attribute of [`RPCStatusCode`](https://python.temporal.io/temporalio.service.RPCStatusCode.html) `NOT_FOUND`. + You'll receive a [`temporalio.client.WorkflowUpdateFailedError`](https://python.temporal.io/temporalio.client.WorkflowUpdateFailedError.html) whose `cause` is an `ApplicationError` of type `AcceptedUpdateCompletedWorkflow`. This happens if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/ruby/workflows/message-passing.mdx b/docs/develop/ruby/workflows/message-passing.mdx index db3196641e..60c14fa062 100644 --- a/docs/develop/ruby/workflows/message-passing.mdx +++ b/docs/develop/ruby/workflows/message-passing.mdx @@ -688,8 +688,7 @@ When working with Updates, you may encounter these errors: Once the Workflow is healthy again after a code deploy, use an [`WorkflowUpdateHandle`](https://ruby.temporal.io/Temporalio/Client/WorkflowUpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`Temporalio::Error::RPCError`](https://ruby.temporal.io/Temporalio/Error/RPCError.html) "workflow execution already completed". - + You'll receive a [`WorkflowUpdateFailedError`](https://ruby.temporal.io/Temporalio/Error/WorkflowUpdateFailedError.html) whose `cause` is an `ApplicationError` of type `AcceptedUpdateCompletedWorkflow`. This will happen if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/develop/typescript/workflows/message-passing.mdx b/docs/develop/typescript/workflows/message-passing.mdx index 8c51f84849..dab069fb01 100644 --- a/docs/develop/typescript/workflows/message-passing.mdx +++ b/docs/develop/typescript/workflows/message-passing.mdx @@ -704,7 +704,7 @@ When working with Updates, you may encounter these problems: Once the Workflow is healthy again after a code deploy, use an [`WorkflowUpdateHandle`](https://typescript.temporal.io/api/interfaces/client.WorkflowUpdateHandle) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a [`client.ServiceError`](https://typescript.temporal.io/api/classes/client.ServiceError) on which the `cause.code` attribute is [gRPC status code](https://grpc.io/docs/guides/status-codes/) 5 `NOT_FOUND`. + You'll receive a [`client.WorkflowUpdateFailedError`](https://typescript.temporal.io/api/classes/client.WorkflowUpdateFailedError) whose `cause` is an `ApplicationFailure` of type `AcceptedUpdateCompletedWorkflow`. This happens if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed. diff --git a/docs/encyclopedia/workflow-message-passing/handling-messages.mdx b/docs/encyclopedia/workflow-message-passing/handling-messages.mdx index afb6b65b7f..a28d66942f 100644 --- a/docs/encyclopedia/workflow-message-passing/handling-messages.mdx +++ b/docs/encyclopedia/workflow-message-passing/handling-messages.mdx @@ -89,7 +89,7 @@ This option is advanced, but it lets you control exactly when each message is pr You should generally finish running all handlers before the Workflow run completes or continues as new. For some Workflows, this means you should explicitly check to make sure that all the handlers have completed before finishing. You can await a condition called All Handlers Finished at the end of your Workflow. -If you don’t need to ensure that your handlers complete, you may specify your handler’s Handler Unfinished Policy as Abandon to turn off the warnings. However, note that clients waiting for Updates will get Not Found errors if they're waiting for Updates that never complete before the Workflow run completes. +If you don’t need to ensure that your handlers complete, you may specify your handler’s Handler Unfinished Policy as Abandon to turn off the warnings. The Temporal Service doesn't drop a Signal that arrives while the Workflow is closing. If it receives a Signal while the Worker is completing the Workflow Task that would complete, fail, or Continue-As-New the Workflow, it rejects that @@ -97,13 +97,22 @@ Workflow Task's completion with an [Unhandled Command](/references/workflow-task discards the Task's Commands. The Worker then gets a new Workflow Task that includes the Signal, which gives the Workflow a chance to process it before closing. In SDKs that register a Signal handler, the handler runs in that Workflow Task. In the Go SDK, the Signal goes to the Signal Channel, -and the Workflow must drain the channel before it returns or the Signal is lost. An Update that arrives at that point -gets the same treatment, with an [Unhandled Update](/references/workflow-task-errors#cause-unhandled-update) error. +and the Workflow must drain the channel before it returns or the Signal is lost. If the main Workflow processes Signals from a queue or channel, check that it's empty in the same Workflow Task that closes the Workflow. Don't wait on anything, such as a Timer or an Activity, between that check and the return. A Signal that arrives during the wait is delivered, but the Workflow has already decided to close and doesn't process it. +An Update that arrives while the Workflow is closing doesn't delay the close. What the client gets depends on whether +the Workflow accepted the Update before the run closed: + +- If the run continues as new before accepting the Update, the client gets a retryable + [busy Workflow](/references/workflow-task-errors#resource-exhausted-cause-busy-workflow) error. Retry the Update and + it goes to the new run. +- If the run closes any other way before accepting the Update, the client gets a `NOT_FOUND` error. +- If the run closes after accepting the Update but before its handler finishes, the client gets an Update failure of + type `AcceptedUpdateCompletedWorkflow`. This applies whatever the handler's Handler Unfinished Policy is. + See the links below for how to ensure handlers are finished in your SDK. #### Message IDs and handling Continue-As-New {/* #exactly-once-message-processing */} diff --git a/docs/references/workflow-task-errors.mdx b/docs/references/workflow-task-errors.mdx index 2b2d318eb5..b919165f05 100644 --- a/docs/references/workflow-task-errors.mdx +++ b/docs/references/workflow-task-errors.mdx @@ -325,10 +325,8 @@ See [Finishing handlers before the Workflow completes](/handling-messages#finish - Cause: `WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_UPDATE` -The Temporal Service received a Workflow Update while the Worker processed a Workflow Task that would close the Workflow Execution. - -The Temporal Service rejects the Workflow Task completion and rewinds the Workflow so that Workflow code handles the pending Update. -This error is common when a Workflow receives frequent Updates. +The Temporal Service doesn't fail Workflow Tasks with this cause. +For what happens to an Update that arrives while the Workflow closes, see [Finishing handlers before the Workflow completes](/handling-messages#finishing-message-handlers). ### Cause Bad Binary {/* #cause-bad-binary */} @@ -411,12 +409,14 @@ Reduce your request rate, or on Temporal Cloud, compare your throughput with the - Cause: `RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW` The target Workflow Execution is busy. -The Temporal Service returns this cause in two cases: +The Temporal Service returns this cause in three cases: - A request timed out waiting for the Workflow Execution's lock. Every operation that changes a Workflow Execution, such as a Signal or an Update, takes this lock. The Service logs `Workflow is busy.` - A Signal arrived while the Workflow Execution was retrying a Workflow Task that closes it, after an [Unhandled Command](#unhandled-command) failure. +- An Update arrived, and the Workflow Execution continued as new before accepting it. -Reduce the rate of requests, such as Signals and Updates, that you send to a single Workflow Execution. +For lock contention, reduce the rate of requests, such as Signals and Updates, that you send to a single Workflow Execution. +For the other two cases, retry the request with backoff. A retried Update goes to the new run. See [Workflow lock contention](/cloud/service-health#workflow-lock-contention-busyworkflow) for guidance by operation. ### Resource Exhausted Cause Circuit Breaker Open {/* #resource-exhausted-cause-circuit-breaker-open */} diff --git a/docs/troubleshooting/request-failures.mdx b/docs/troubleshooting/request-failures.mdx index 14415368bb..cac74afd68 100644 --- a/docs/troubleshooting/request-failures.mdx +++ b/docs/troubleshooting/request-failures.mdx @@ -121,13 +121,13 @@ Log these failures in your application code so you can backfill starts and Signa The Temporal Service throttles these operations last, so a rate limit, overload, or circuit-breaker cause here means throttling is already severe and widespread. A busy Workflow cause is different. It can mean a request timed out waiting for a Workflow Execution's lock, the [most common cause](/cloud/service-health#workflow-lock-contention-busyworkflow) of RESOURCE_EXHAUSTED on these operations. -The Temporal Service also returns this cause when it rejects a Signal while retrying a Workflow Task that closes the Workflow; retry that Signal with backoff. +The Temporal Service also returns this cause when it rejects a Signal while retrying a Workflow Task that closes the Workflow, or an Update that the Workflow didn't accept before it continued as new. Retry that request with backoff. **Triage.** 1. **Find out which limit you hit.** A Namespace rate limit, a concurrency limit, contention on one Workflow Execution, system-wide overload, and an open circuit breaker are different problems with different fixes. On the Go SDK, group [`temporal_request_resource_exhausted`](/references/sdk-metrics#request_resource_exhausted) by its `cause` tag and it will tell you directly. On other SDKs, work through the steps below. 1. **Check your traffic against your Namespace limits.** For a rate limit cause (`RESOURCE_EXHAUSTED_CAUSE_RPS_LIMIT` or `RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT`), compare current throughput against your Namespace's [service limits](/evaluate/cloud/limits) on Temporal Cloud, and open a support request if you need them raised. -1. **Respond to a busy Workflow cause based on its source.** For sustained lock contention, requests time out waiting for one Workflow Execution's lock, so raising Namespace limits won't help. Batch Signals, cap in-flight Updates, or spread the work across more Workflow Executions. If the Service rejects a Signal while retrying a Workflow Task that closes the Workflow, retry the Signal with backoff instead. See [Workflow lock contention](/cloud/service-health#workflow-lock-contention-busyworkflow) for per-operation guidance. +1. **Respond to a busy Workflow cause based on its source.** For sustained lock contention, requests time out waiting for one Workflow Execution's lock, so raising Namespace limits won't help. Batch Signals, cap in-flight Updates, or spread the work across more Workflow Executions. If the Service rejects a Signal while retrying a Workflow Task that closes the Workflow, or an Update because the Workflow continued as new, retry the request with backoff instead. See [Workflow lock contention](/cloud/service-health#workflow-lock-contention-busyworkflow) for per-operation guidance. 1. **Treat overload and circuit-breaker causes as capacity problems.** `RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED` and `RESOURCE_EXHAUSTED_CAUSE_CIRCUIT_BREAKER_OPEN` mean the Temporal Service is shedding load to protect itself. A higher limit will not help; the Service needs capacity, or your workload needs to slow down. 1. **Add backoff in your application.** If throttling is expected during traffic peaks, ensure calling code retries with backoff rather than tight-looping, which amplifies the pressure. From ac2eb312c96535017f4af0cddaf219d38b321544 Mon Sep 17 00:00:00 2001 From: Duncan Mackenzie Date: Mon, 30 Nov 2026 11:29:29 -0800 Subject: [PATCH 2/3] Say to retry an Update without the old Run ID after Continue-As-New --- .../workflow-message-passing/handling-messages.mdx | 4 ++-- docs/references/workflow-task-errors.mdx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/encyclopedia/workflow-message-passing/handling-messages.mdx b/docs/encyclopedia/workflow-message-passing/handling-messages.mdx index a28d66942f..b815b691d3 100644 --- a/docs/encyclopedia/workflow-message-passing/handling-messages.mdx +++ b/docs/encyclopedia/workflow-message-passing/handling-messages.mdx @@ -107,8 +107,8 @@ An Update that arrives while the Workflow is closing doesn't delay the close. Wh the Workflow accepted the Update before the run closed: - If the run continues as new before accepting the Update, the client gets a retryable - [busy Workflow](/references/workflow-task-errors#resource-exhausted-cause-busy-workflow) error. Retry the Update and - it goes to the new run. + [busy Workflow](/references/workflow-task-errors#resource-exhausted-cause-busy-workflow) error. Retry the Update with + the Workflow ID and no Run ID, and it goes to the new run. A retry that names the old Run ID targets the closed run. - If the run closes any other way before accepting the Update, the client gets a `NOT_FOUND` error. - If the run closes after accepting the Update but before its handler finishes, the client gets an Update failure of type `AcceptedUpdateCompletedWorkflow`. This applies whatever the handler's Handler Unfinished Policy is. diff --git a/docs/references/workflow-task-errors.mdx b/docs/references/workflow-task-errors.mdx index b919165f05..b64353520a 100644 --- a/docs/references/workflow-task-errors.mdx +++ b/docs/references/workflow-task-errors.mdx @@ -416,7 +416,7 @@ The Temporal Service returns this cause in three cases: - An Update arrived, and the Workflow Execution continued as new before accepting it. For lock contention, reduce the rate of requests, such as Signals and Updates, that you send to a single Workflow Execution. -For the other two cases, retry the request with backoff. A retried Update goes to the new run. +For the other two cases, retry the request with backoff. Retry an Update with the Workflow ID and no Run ID so that it goes to the new run. See [Workflow lock contention](/cloud/service-health#workflow-lock-contention-busyworkflow) for guidance by operation. ### Resource Exhausted Cause Circuit Breaker Open {/* #resource-exhausted-cause-circuit-breaker-open */} From 98b84f24abb1190b2598f6f8a5589e8e212d80b5 Mon Sep 17 00:00:00 2001 From: Duncan Mackenzie Date: Tue, 1 Dec 2026 10:04:13 -0800 Subject: [PATCH 3/3] Link WorkflowUpdateException in the Java Update error list --- docs/develop/java/workflows/message-passing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/java/workflows/message-passing.mdx b/docs/develop/java/workflows/message-passing.mdx index 6fd3e50bc2..ee240f9db2 100644 --- a/docs/develop/java/workflows/message-passing.mdx +++ b/docs/develop/java/workflows/message-passing.mdx @@ -796,7 +796,7 @@ When working with Updates, you may encounter these errors: Once the Workflow is healthy again after a code deploy, use a [`WorkflowUpdateHandle`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowUpdateHandle.html) to fetch the Update result. - **The Workflow finished while the Update handler execution was in progress**: - You'll receive a `WorkflowUpdateException` whose cause is an `ApplicationFailure` of type `AcceptedUpdateCompletedWorkflow`. + You'll receive a [`WorkflowUpdateException`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowUpdateException.html) whose cause is an `ApplicationFailure` of type `AcceptedUpdateCompletedWorkflow`. This will happen if the Workflow finished while the Update handler execution was in progress, for example because - The Workflow was canceled or failed.