Power AutomateIntermediate

Try/Catch error handling in Power Automate with scopes

Stop silent flow failures. Use Try, Catch and Finally scopes, configure run after correctly, and send a useful alert with a link to the failed run.

Prerequisites

  • A cloud flow you want to make reliable
  • A Teams channel or mailbox for alerts

What you'll learn

  • Build Try, Catch and Finally scopes
  • Configure run after for failed and timed-out actions
  • Find the error message with result()
  • Send an alert that links straight to the failed run
On this page
  1. The pattern
  2. Configure run after
  3. Find out what went wrong
  4. Link to the failed run
  5. Send the alert and fail properly
  6. Make it reusable

By default, when an action fails the flow simply stops. Nobody is told, and you find out days later. Scopes fix that.

The pattern

Add three Scope actions:

  1. Try — all your normal actions go inside.
  2. Catch — runs only if something in Try fails.
  3. Finally — optional; runs every time, for clean-up or logging.

Configure run after

Open the Catch scope's settings, choose Configure run after, and tick has failed and has timed out for the Try scope. Untick is successful.

In code view, the setting looks like this:

JSON
"runAfter": {
  "Try": ["Failed", "TimedOut"]
}

Find out what went wrong

Inside Catch, add a Filter array on the results of the Try scope to keep only the failed action:

JavaScript
// From
result('Try')
// Condition
item()?['status'] is equal to 'Failed'

The error message is then available with:

JavaScript
first(body('Filter_array'))?['error']?['message']

This expression builds a direct link to the run history, so whoever gets the alert can open the failed run in one click:

JavaScript
concat(
  'https://make.powerautomate.com/environments/',
  workflow()?['tags']?['environmentName'],
  '/flows/', workflow()?['name'],
  '/runs/', workflow()?['run']?['name']
)

Send the alert and fail properly

  1. Post a message to Teams (or send an email) with the flow name, the error message and the run link.
  2. Add Terminate with status Failed at the end of Catch.

Without Terminate, the flow shows as Succeeded because the Catch scope ran fine — which hides the problem from your run history and monitoring.

Make it reusable

Put this pattern in a template flow or copy the scopes between flows. Once every flow has it, silent failures disappear.

J / K next or previous article

Jagadeesan P

Found this useful? I share new guides on LinkedIn.

Follow