How to Handle Errors and Retries in Power Automate

Loading

Overview

Error handling in Power Automate ensures that workflows run smoothly even when issues occur. Retries, error handling, and timeout settings help prevent failures and improve reliability.


1️⃣ Common Errors in Power Automate

Error TypeCauseExample
API Call FailureAPI is down, authentication issueHTTP request to SharePoint fails
Invalid DataIncorrect format, missing valuesJSON parsing fails due to missing key
TimeoutAction takes too longLarge file upload to OneDrive
Access DeniedPermission issuesTrying to update a restricted SharePoint list
Action SkippedMissing input from a previous stepFlow fails because a required field is empty

2️⃣ How Power Automate Handles Errors by Default

Retry Policy: Power Automate automatically retries failed actions up to 4 times with exponential backoff (except for certain actions).
Error Handling Options:

  • Use “Run After” settings to handle failures
  • Use “Scope” actions for structured error handling
  • Implement “Try-Catch-Finally” logic

3️⃣ Enabling Error Handling in Power Automate

Method 1: “Run After” Error Handling

Best for: Handling failures of specific actions

1️⃣ Click on an action (e.g., Send Email, API Call, HTTP Request, etc.)
2️⃣ Click the ellipsis (⋮) → “Configure Run After”
3️⃣ Choose one or more conditions:

  • “is successful” (default)
  • “has failed” (error occurred)
  • “is skipped” (previous step failed)
  • “has timed out” (action took too long)
    4️⃣ Add alternative actions, like logging the error or sending an alert

Example: Handling a Failed API Call
If an HTTP request fails, send an error email instead of stopping the flow.


Method 2: Using “Scope” for Try-Catch-Finally Logic

Best for: Handling multiple actions within a structured block

1️⃣ Add a “Scope” action
2️⃣ Inside, add the actions you want to monitor (Try block)
3️⃣ Add a second “Scope” (Catch block) to handle errors
4️⃣ Configure “Run After” settings:

  • The Catch block runs “when the previous scope has failed”
    5️⃣ (Optional) Add a “Finally” Scope that runs regardless of success or failure

Example: Try-Catch in Power Automate
Try: Call an external API
Catch: Log the error in a SharePoint list
Finally: Send a completion email


Method 3: Adjusting Retry Policy for Actions

Best for: Handling transient failures (temporary API outages)

1️⃣ Click on an action (e.g., HTTP request, Dataverse update)
2️⃣ Click ellipsis (⋮) → Settings
3️⃣ Enable Retry Policy
4️⃣ Choose a retry type:

  • Default (up to 4 retries)
  • Exponential Interval (waits longer between retries)
  • Fixed Interval (retry at a fixed time gap)
    5️⃣ Set the retry count and interval

Example: Handling an API Call Failure
If an API call fails due to network issues, retry 3 times every 30 seconds before failing.


Method 4: Using “Terminate” Action for Custom Error Handling

Best for: Controlling flow termination with a custom error message

1️⃣ Add a “Condition” to check if an error occurs
2️⃣ If true, add a “Terminate” action
3️⃣ Set “Status” to:

  • Succeeded (force success)
  • Failed (with error message)
    4️⃣ (Optional) Send an error notification via email or Teams

Example: Custom Error Handling in Approval Flow
If an Approval process fails, terminate the flow and send a Teams alert.

4️⃣ Best Practices for Handling Errors & Retries

Use “Run After” Settings – Ensure alternate actions run when an error occurs
Enable Retry Policy for Transient Failures – Helps recover from temporary issues
Log Errors in SharePoint or Dataverse – Track failures for debugging
Use Try-Catch with Scope Actions – Organizes complex error handling
Send Notifications on Failure – Alert users via email or Teams when something goes wrong
Limit Unnecessary Retries – If an API is known to fail, retrying excessively wastes time

Leave a Reply

Your email address will not be published. Required fields are marked *