Error Handling in Power Automate: The Complete Guide
Juan Carlos Santiago
Error Handling in Power Automate: The Complete Guide
Error handling is the backbone of reliable automation. Without proper error management, your Power Automate flows fail silently or leave your team scrambling. Let's explore proven patterns that transform fragile flows into robust solutions.
Understanding Run After Configuration
Run After is your foundation for error handling. Every action has execution conditions: Success, Skipped, Failed, and TimedOut.
Real Pattern: Graceful Degradation
When calling an external API, configure the next action to run "after previous action has failed." This lets you provide fallback behavior:
Action 1: Call External API
↓ (if fails)
Action 2: Log Error + Use Default Values
↓
Action 3: Continue Process
This prevents entire flow failures from a single API timeout.
Scope Blocks as Try-Catch Patterns
Scope actions are your try-catch equivalent. They group multiple actions, and you configure what happens when the scope fails.
Real Pattern: Data Validation Scope
Scope: Validate Customer Data
├─ Check Email Format
├─ Verify Account Exists
└─ Validate Phone Number
Run After Validation Scope Fails:
├─ Send Alert to Admin
├─ Terminate with Error
This isolates validation logic. If any step fails, the entire scope fails gracefully without corrupting downstream data.
Sending Error Notifications
Your team needs visibility. Configure notifications when errors occur:
Add Action: Send an Email
To: admin@company.com
Subject: Flow Error Alert
Body:
Flow Name: @{triggerOutputs()?['flowDisplayName']}
Error: @{body('Scope')?['errors'][0]?['message']}
Time: @{utcNow()}
Include the trigger data, error details, and timestamp. This gives your team context for debugging.
Logging Errors to SharePoint
Transient logs disappear. Store errors permanently in SharePoint for auditing and pattern detection.
Real Pattern: Error Log List
Create a SharePoint list with columns: FlowName, ErrorMessage, ErrorCode, FailedAction, Timestamp, TriggerData.
On any scope failure:
Add Action: Create Item
Site: operations-hub
List: Flow Error Log
Fields:
- FlowName: @{triggerOutputs()?['flowDisplayName']}
- ErrorMessage: @{body('Scope')?['errors'][0]?['message']}
- FailedAction: @{body('Scope')?['errors'][0]?['source']}
- Timestamp: @{utcNow()}
- TriggerData: @{triggerBody()}
After 30 days, you'll identify patterns: missing fields, rate limits, authentication issues.
Implementing Retry Policies
Not all failures are permanent. Configure retry policies on critical actions:
Settings on HTTP Actions:
- Retry Policy: Exponential
- Max Retries: 3
- Backoff: 2 seconds (increases exponentially)
This handles transient network blips without flow failure. Perfect for API calls and database operations.
The Terminate Action
Know when to stop. Use Terminate to halt execution with a clear status.
Real Pattern: Fail Fast
Condition: Is Request Valid?
├─ Yes → Continue
└─ No → Terminate
Status: Failed
Code: INVALID_REQUEST
Message: Missing required field: CustomerID
This is cleaner than letting invalid data cascade through your flow.
Putting It Together: Complete Pattern
Trigger: When Item Created
↓
Scope: Process Order
├─ Validate Order Data
├─ Call Inventory API (with retry policy)
└─ Update SharePoint List
↓ Run After Fails:
├─ Create Error Log in SharePoint
├─ Send Email to Support
├─ Terminate with Error Code
This gives you observability, recovery options, and clear failure communication.
Pro Tip
Never use generic error messages. Always include the specific failed action and the original request data in your logs. When debugging at 2 AM, you'll thank yourself for that context. Add @{body('FailedAction')} and @{triggerBody()} to every error notification.
