"Unable to assign" error

This is a strange error and I’m not sure why it’s happening.

I have an If inside a Try Catch because the condition will throw an exception if the automation was unable to properly parse the data retrieved from a mainframe screen. This is fine, I just need to handle the error.

This is all inside an outer Try Catch that simply sets a couple values in the datatable row (it’s all in a For Each Row loop). For some reason, I’m getting this error:

image

I don’t understand why it’s not working. Here is the code:

The interior Try simply catches any exception, sets a value and then Throws an exception up to the main Try Catch:

image

And here is the BusinessRuleException block of the main Try Catch:

image

Thinking that the issue is the nested Try Catches, I changed it to an IF that checks the value of CDAAmount and Throws an exception:

image

Which jumps to this catch block:

image

As you can see from the Orchestrator log, exception.Message has a valid value, but the Multiple Assign second item still fails:

image

I’m stumped. As shown here, the Catch is correctly inside the loop.

Looks like a bit of a conundrum, as the exception is being passed correctly due to the output of the log.

Just to confirm your dictionary has the “Validation Details” key correctly assigned? Just a quick glance.

I have used nested try catches in a similar fashion and have not experienced that before.

Yes Validation Details is correct. I assign values to it in many places:

image

I’m stumped and the error message isn’t very helpful.

@loginerror Sorry to bother you directly, but I was hoping you or someone from UiPath might be able to offer some clues to what this error message means.

We turned on verbose logging and I see this now:

image

How can a Throw fault?

image

image

But it still gets to the Assign in the BusinessRuleException catch which also faults:

image

image

@Gabriel_Tatu @badita

I tried the suggestion in this thread (changing new BusinessRuleException to new UiPath.Core.BusinessRuleException) and the Throw still faults.

Can someone please assist me? We are logging an Incident via support (we are an Enterprise customer) but if you could help me more quickly that would be great.

I couldn’t immediately see something. One question, what is row in this Throw?
image

Apart from that, could you maybe share a sample xaml that reproduces the issue? If uploading files is an issue, a new, dummy, fresh project with minimum steps to reproduce the issue and no sensitive data will be enough, even pasted as a code text block here on the Forum rather than an attachment.

I have been unable to reproduce it in a test project, and there are other Throws in the same code that work fine. It is very perplexing. We are in trial and error mode. About to test specifically designating the max length of this column even though the default shouldn’t be limited. Another possibility is that for some reason it doesn’t like the data in “row” - but it’s just a string so I don’t see how that would be an issue.

Those types of issues are the worst to track down. I’d definitely start with an assignment of a static empty string first and see if it will work then.

But actually, I’ll give some context to something that happened to me yesterday that I found strange that may be the answer.

I wrote down this expression before making a variable:

I then created a datetime variable which defaults to String. The moment I did that, it confused the namespaces and I got this:

Maybe I’m stretching it, but maybe something like this happened? (I didn’t run this, just some extra ideas to consider):

Yeah that’s on my list of things to try. I’m currently in “try one small change then test” mode.

Are you thinking that maybe just deleting the Throw and recreating it will work, because somehow it got corrupted like yours did due to the order things were created?

I would definitely try that, together with the empty string beforehand. After these two steps it should become more clear.

Another option to try:

  • exception instead of businessruleexception (just to see if it changes things)
  • carefully strip down the process to a bare minimum until the issue stops reproducing (=make a copy of it, and then start removing packages and activities, leaving only the faulty ones) → such minimal project, if it still causes the issue, would be great to have for our team to investigate

We did have a UiPath support person get on a call with me, and one of the ideas he had was to explicitly set the length of the column in the Add Data Column activity. So we set it to 1024. Then in the Assign myDT(“Validation Details”) = exception.Message I changed it to Left(exception.Message,1020) and it worked. The Assign no longer faults and the automation correctly logs the check as failed validation and moves to the next check.

I don’t know why this worked. It doesn’t seem like it should, because my understanding is the default max column length is -1 (ie unlimited)…but it worked.

1 Like