At the moment understanding the NOT_FOUND error raised when requesting a termination requires checking the workflow status before hand since it could also mean that the workflow is already completed.
Is there a better way I am not aware of?
Could we use a different error code instead like ABORTED or FAILED_PRECONDITION?
Unfortunately, there is no better way to differentiate “workflow doesn’t exist” and “workflow has been already terminated” with TerminateWorkflow API call. I agree that FAILED_PRECONDITION would be a more accurate error code in case of already terminated workflow. But the problem is wide and there are many places which error codes need improvements.
Thanks a lot for your reply and for creating the GitHub issue. I understand that this touches a broader topic of having better error codes in other places as well.
If you need I can start tracking those places if you have a place to report them? So that we can link it to the GitHub issue and when the day comes they can be tackled more easily?
I think just adding references to the code as issue comments should be good enough. We have proposals repo but I think this is more like “non-critical bug fix”.
I really appreciate if you do this and collect at least those which you are aware of. It will help us not to overlook them.