Hi @maki_XIE
NonDeterministicException is not propagated to workflow code, as you have mentioned you can not catch it.
To stop your workflow from retrying the workflow task when facing a non-deterministic code, you can use setFailWorkflowExceptionTypes in WorkflowImplementationOptions
WorkflowImplementationOptions.newBuilder()
.setFailWorkflowExceptionTypes(NonDeterministicException.class)
.build(),
Another way is to set WorkflowRunTimeout in your WorkflowOptions to limit the duration of your workflow run, so after some time including workflow task retries, the workflow will fail.
Both options will fail your Workflow Execution.