Impossible to catch a System.InvalidOperationException exception with Try&Catch activity

Hi there,

I’m using a Pick activity with 4 pick branches inside.
Each of these pick branch activities have a find image activity as trigger.

If any of these 4 pick branch activities fail to trigger, because he image is not visible, then 2 exceptions are triggered: a timeout exception and a System.InvalidOperationException.

I’ve surrounded the pick activity with a try & catch in order to catch these 2 exceptions.
The timeout exceptions is catched, but the InvalidOperationException continues to be triggered. Even with a Try&Catch.

Is there some kind of bug in UiPath Studio?

Or what other way do I have to detect the situations where none of those 4 images are found?

If you dont have any specific action to do corresponding to the type of exception, then use System.Exception. This catches all the exceptions. You may log the exception details from catch block.

I’m also getting System.InvalidOperationException exception while using a On Image Appear activity inside a pick branch. Any idea why this exception is thrown instead of timeout exception?


Any news about this issue. I have same problem with 2018.4.5 that I cannot catch exception (exception base) thrown from pick branch at the first try-catch. Second try-catch is catching those anyway.

Any good ideas? Or known if there is going to be fix for this issue from UiPath side?

Hi @Mikko

Could you try to wrap your activities in each branch in their own Try-Catch? It might help a little, hopefully.

How does one report a bug?
I would say that is definetly a bug…

I moved section with own Workflow and added call of that new workflow into try section. Then try-catch works but not in the same workflow.

Hanki Outlook for Android

Hey, guys! Any news on that?? I am having the same problem but instead of using pick branches I’m using OCR enggines. It seems that it’s not only one error in my case, but I used System.Exception and it’s not working either

@loginerror please report this problem as a bug to be solved for a future release.

Thank you.

Hi @jcob

If you have access to Studio Community Edition, then see here for the easiest way to report bugs starting from 2019.7 :slight_smile:

Any work around for this or recommendation on another activity etc…? Thanks!

I’ve found many posts reporting similar cases in forum posted since 2017 but it seems not fixed until now :confused:
I don’t know why exactly but, I guess it is related with pick and pick branch activities… because I’m using pick activity now and same error is occurring.
And other posts are using same thing. Pick and pick branches.

1 Like

@pablito @loginerror please report this as a bug

1 Like

As a result of a week using the activity, I guess two problems with pick:

  1. When pick and pick branches are used with element activities, they makes both of InvalidOperationException and ActivityTimeoutException in one time intermittently.
  2. Try Catch activity cannot catch exceptions from 1’s case.

And… it’s just FYI, I moved them out from some element containers (e.g. attach browser, element scope…) and they works well and makes no exception. I tested it over 5 hours… and no exceptions until now. Hope this can be helpful if you’re going to report this bug.

1 Like

Hi @Sodam

What do you mean by:

I moved them out from some element containers (e.g. attach browser, element scope…) and they works well and makes no exception


Hi @loginerror

I meant, I was using pick inside of attach browser, because I wanted to make them work inside chrome window. And they made exceptions.
Then I changed attach browser to element scope, they also made exceptions.
And I separated pick activity to other .xaml file and invoked it into main workflow. It didn’t make any exceptions.
After then, I got them back into main workflow, not invoked, just replaced to outside of containers, and they didn’t make any exceptions too.
Hmm… is it understandable? I’m sorry for my bad English. :frowning:

Almost all clear, don’t worry :slight_smile:

I suppose a screenshot of the working scenario would help me get it fully:

After then, I got them back into main workflow, not invoked, just replaced to outside of containers, and they didn’t make any exceptions too.

1 Like

I’ll upload it tomorrow. Here is UTC +9 and now is overtime work. :smiley:
Thank you for your understanding!

1 Like

Hi @loginerror

I tried to occur same error whole day but failed :frowning:
I don’t know why but I made workflow totally same with yesterday… and failed to occurring error.
So I’m uploading a file that include the same workflow. Sample.xaml (37.4 KB)
This file was made on 2019.10.0-beta.484 community edition and the error threw on 2018.2.3 Enterprise edition.
Maybe it was not element container’s side… sorry :frowning:

Hi @jcab,

I’ve faced the same issue, but I have found a way out from this situation.

To handle this, I’ll suggest you to

  1. Put that pick activity with all branches in one separate sequence and Invoke that sequence (pick) in your main sequence.
  2. Now, use Try&Catch and put Invoke Workflow in try block and catch the exception.

This worked for me, I hope it’ll work for you too. :slightly_smiling_face:

One more thing…

I don’t know it is bug or not but I’ve created one Topic in Ideas section, have a look if you want.
here’s the link —> Pick activity should come with one Default branch