Hello,
I have a specific exception defined like
class Retry(Exception):
pass
in a workflow in which the Retry exception is raised. In the worker’s log I got the following message. As the Retry exception is know, I don’t need the stack trace and it pollutes the logs. And the error is logged twice (once " Failed activation on workflow" and one “Failing workflow task”).
it’s a lot of useless stuff that noises the logs and slows the time to analyse what’s happening.
Failed activation on workflow Sample with ID Sample-380788 and run ID 01983813-4b98-7ec8-a0cb-1d4f08925a72
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 412, in activate
self._run_once(check_conditions=index == 1 or index == 2)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2130, in _run_once
raise self._current_activation_error
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2148, in _run_top_level_workflow_function
await coro
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 974, in run_workflow
result = await self._inbound.execute_workflow(input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2529, in execute_workflow
return await input.run_fn(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/pcs/robots/workflows/sample.py", line 70, in run
raise Retry(f"error but retry with message '{params.task.arguments['retry']}'")
pcs.robots.lib.exceptions.Retry: error but retry with message 'RetryNormalException'
2025-07-23T16:17:25.462269Z WARN temporal_sdk_core::worker::workflow: Failing workflow task run_id=01983813-4b98-7ec8-a0cb-1d4f08925a72 failure=Failure { failure: Some(Failure { message: "error but retry with message 'RetryNormalException'", source: "", stack_trace: " File \"/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py\", line 412, in activate\n self._run_once(check_conditions=index == 1 or index == 2)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n File \"/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py\", line 2130, in _run_once\n raise self._current_activation_error\n\n File \"/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py\", line 2148, in _run_top_level_workflow_function\n await coro\n\n File \"/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py\", line 974, in run_workflow\n result = await self._inbound.execute_workflow(input)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n File \"/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py\", line 2529, in execute_workflow\n return await input.run_fn(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n\n File \"/app/pcs/robots/workflows/sample.py\", line 70, in run\n raise Retry(f\"error but retry with message '{params.task.arguments['retry']}'\")\n", encoded_attributes: None, cause: None, failure_info: Some(ApplicationFailureInfo(ApplicationFailureInfo { r#type: "Retry", non_retryable: false, details: None, next_retry_delay: None, category: Unspecified })) }), force_cause: Unspecified }
2025-07-23 16:17:25,473 [worker masterbot] [@db_session] session.merge(Task#380788
2025-07-23 16:17:25,526 [worker masterbot] Failed activation on workflow Sample with ID Sample-380788 and run ID 01983813-4b98-7ec8-a0cb-1d4f08925a72
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 412, in activate
self._run_once(check_conditions=index == 1 or index == 2)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2130, in _run_once
raise self._current_activation_error
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2148, in _run_top_level_workflow_function
await coro
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 974, in run_workflow
result = await self._inbound.execute_workflow(input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/temporalio/worker/_workflow_instance.py", line 2529, in execute_workflow
return await input.run_fn(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/pcs/robots/workflows/sample.py", line 70, in run
raise Retry(f"error but retry with message '{params.task.arguments['retry']}'")
pcs.robots.lib.exceptions.Retry: error but retry with message 'RetryNormalException