web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / On Block Error not tri...
Power Automate
Unanswered

On Block Error not triggering "index out of range" error

(1) ShareShare
ReportReport
Posted on by 32

Hello

I have an On Block error that executes a subflow to get the last error that occurred, but I have realized that some errors are not triggered with the "On Block Error", for example, the error "index out of range" when you are trying to access to an invalid position of an array variable.

I have been reading that this is a bug of PAD, so I'm asking if someone has a workaround to solve this issue

 

Thanks!

Antonio

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Hi @aontanon 

     

    True, this issue is for many variables in PAD that uses indexing.

    You may want to upvote this feature here so that it is implemented soon in PAD.

     

    Regarding a workaround, 

    At first get the count of the elements in the variable.

    For eg; %MyList.Count% gives the count in my List variable called MyList.

     

    Whenever you are using the variable with an index, make sure that the index does not exceed the above count value.

    This check can be done with a simple "If" statement.

    Also note that the indexes start from 0 (zero).

     

  • aontanon Profile Picture
    32 on at

    Hello @VJR 

    Thanks for your response.

    yes, you can control this error with the code you are commenting on, however, the On Block Error should trigger these kinds of errors

    I have another error that I don't know how to capture with code, which is "Run desktop flow", when you are calling to another flow and this flow triggers an error.

     

    For example, if flow "idealista" has an error, the main flow triggers the error "Run desktop flow" and this error is not captured by On Error block.

    aontanon_0-1635345555972.png

    This is a problem for me because I want to send an email if there is an error in the main flow.

     

    Thanks!

     

    Best regards, 

    Antonio

     

  • VJR Profile Picture
    7,635 on at

    Hi @aontanon 

     

    When I added as below it worked for me.

    Not sure if you are looking for something different.

     

    VJR_0-1635393374895.png

     

    I have set the ErrorFlag to True if there is an error 

     

    VJR_1-1635393452735.png

    And at the end of block if ErrorFlag is True then send out an email.

     

  • aontanon Profile Picture
    32 on at

    Hi @VJR 

    yes, you are right, I was not coding correctly.

    Thanks!

     

  • VJR Profile Picture
    7,635 on at

    @aontanon , good to hear that its working for you now. If you think any of the above posts helped you to achieve what you wanted to then mark it as a solution and close the thread.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 953

#2
Valantis Profile Picture

Valantis 810

#3
Haque Profile Picture

Haque 622

Last 30 days Overall leaderboard