cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CarlosFigueira
Power Apps
Power Apps

Workaround for the <Internal error in the Or function: Canceled: Canceled> message

TL;DR: If you see this error (similar for the And function), this is a spurious message that should not be displayed. The message does not affect the app runtime - it should still be working as before. To remove this message, please use this expression in the new App.OnError property to suppress it:

 

 

Error(Filter(AllErrors, Not (": Canceled" in Message), Not IsBlank(Message)))

 

 

More details: In a recent release (version 3.21122) we made a change so that errors that are not handled by the app would start being shown to the user. The idea was to make it more explicit when bad things happen in the app. However, one of those errors that are being shown are not caused by the app itself, but by an optimization made by the platform, and should not be displayed to the user.

 

This is one scenario where this can happen: a label has a Text property set to the following expression:

 

 

If(
    Or(
        LookUp(MyTable, Name = TextInput1.Text, IsActive),
        LookUp(MyOtherTable, Name = TextInput1.Text, IsActive)),
    "The record is active",
    "The record is inactive")

 

 

When there is a change in TextInput1, the rule will be re-evaluated, and if the LookUp can be delegated, a pair of network calls is made to retrieve the corresponding IsActive properties. If, before the call is completed, the value of the TextInput1 is changed again, the platform cancels the pending network calls (since their result would be stale), and starts new requests to retrieve the values of the IsActive property again.

 

When the LookUp calls are cancelled, the Or function will receive that cancellation, and it is treating it as an error (because it could not complete its calculation). The error is then bubbled up via the If function, and since it is not handled by the app, the message is shown to the user. When the network responses for the new LookUp calls arrive, the label value will be updated to what it was supposed to be, and the app continues working as it should. But the user will see the message that they shouldn't.

 

We are making a change to stop treating cancellation as errors (because they are not), but it will take a few weeks for the change to reach all regions. Meanwhile, we can use the new App.OnError property to "trap" those spurious cancellation errors so that they don't bubble up to the user. A way to do that is to filter the errors that are passed to it, removing those that are of this type. The expression below should take care of it:

 

 

Error(Filter(AllErrors, Not (": Canceled" in Message), Not IsBlank(Message)))

 

 

Hopefully this will help until the fix is properly deployed worldwide.

17 REPLIES 17
virakones
Responsive Resident
Responsive Resident

Thank you for the workaround - this will give our users some peace of mind til fully resolved.

timl
Super User
Super User

@CarlosFigueira - Many thanks for this excellent explaination and for the interim fix.

JR-BejeweledOne
Super User
Super User

I followed this and now am getting an Invalid argument type Message.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
cleve
Advocate I
Advocate I

@CarlosFigueira Thank you for the workaround. There is an extra parenthesis in your solution. 

Error(Filter(AllErrors, Not ": Canceled" in Message))

 

murphydm
Advocate I
Advocate I

I've been seeing this in some of the SharePoint Forms I developed for my agency, these don't seem to have an App.OnError property that I'm aware of. Is there a similar solution that I can apply to my forms while we wait for a real fix? I tried If(!(": Canceled" in SharePointForm.Error),Notify(SharePointForm_1.Error,NotificationType.Error)) in onFailure but that doesn't have any impact on this.

@cleve thank you, updated it

@murphydm you should be able to find the OnError property of the App object as shown below:

AppOnErrorOnSharePointForms.gif

If you cannot find that property, can you let me know what version are you running? You should be able to find it at the Settings menu on top, then selecting Support and 'Session details'

Haha jeez, embarrassing, I'm not sure if I knew that App was clickable until you told me. Thank you!

james_hathaway
Advocate IV
Advocate IV

Thanks @CarlosFigueira ,

 

Very Useful workaround at least allows me to publish new App versions....

 

So, I've just done an update to one of our Clients Apps, and I included the workaround to catch both the DIV/0 errors and the Or/And "Cancelled" errors.... but any idea what I use to catch the following error given to the Users?

james_hathaway_0-1643294716213.png ??

 

The Monitor is telling me its a "RegEx Error", with no further detail, but that actually kind of makes sense, as there's a Value(Text) formula in the App that tries to convert a "Currency Formatted String" into a numerical value (i.e. "£2.55" -> 2.55), - no doubt the code behind the PowerApps abstraction layer would use Regular Expressions to parse the text so that it can convert decimal and thousand separators, % symbols etc, depending on language/locale settings...

 

I have heard that there is currently a known RegEx error in the Value function, and that a fix is working it's way through, so I'm not going to open that can of worms.... but I guess question for here is:

 

How would we catch "RegEx Errors" in the App.OnError property to stop them bubbling up to the Users?

 

Thanks!

 

James.

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,573)