Why an invocation-related exception is obtained while publishing the workflow from Studio?
Issue Description
While publishing the automation workflow from Studio to Orchestrator, an exception that says "Unexpected error has occurred during the library compilation process: The following workflows are in at least one invocation cycle: __________" is received.
Root Cause
This error usually appears when one of the mentioned workflows is invoked using the Invoke Workflow File and somewhere between those Invokes, one of them is called again, creating a (possible) loop.
Example:
Resolution
Check the associated activities in the automation, and make sure the 3 workflow files are not calling each other (e.g.: Calling B in A and A in B, etc).
Note: This issue was caused by a bug affecting major versions 21.10, 22.4, 22.10 and 23.4 Studio. This was fixed starting with version 23.10.0.
In my opinion, encountering an invocation-related exception while publishing a workflow from UiPath Studio to Orchestrator is a significant hindrance for developers. Recursion is a crucial aspect of programming, and it is better not to limit it in this way. Components that invoke themselves are often used when searching through nested files and folders or nested data. Detecting potential infinite loops is not worth the trouble, and at most, a warning could be issued.
I’ve come across the same error, and I fully agree with Konrad_Mierswa’s viewpoint on the importance of recursion in programming. Personally, I believe it would be more helpful to have a warning message rather than an error in this scenario.
I have come across the same error as well.
I have a bot which uses recursion to solve for the combination of n number of invoices that matches a specific payment amount. (Which I believe it’s quite a common use case). The bot works well but I’m not able to publish it due to this error. Is there any workaround available?
Recursion works fine in Windows-Legacy projects, but it seems that it’s not yet supported in Windows. Do you have any ETA on this? Currently represents a blocker in migrating from Legacy to Windows.
It is absurd that UiPath restricts such a fundamental concept as recursion.
They also allow you to test it, figure out it works to solve whatever problem is at hand but stops you from publishing the package. Which is even more absurd.
My workaround is to use flowchart in which I link to the first activity when I want to call recursive (so instead of wraping everything in sequence and calling the same workflow in it, I put the workflow into flowchart and in this case it works…)