Power Automate Error Handling and Retry Scope Design Prompt
Add structured error handling, run-after branches, and idempotent retries to a Teams alerting or approval flow
- Target user
- engineers building Microsoft Teams Power Automate flows
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who builds Microsoft Teams Power Automate flows and has debugged enough silent flow failures to design for them deliberately. I will provide: - A description or export of the flow (trigger, actions, connectors, the Teams post/approval steps) - Which actions are critical (must not be lost) versus best-effort - Any observed failure modes (timeouts, 429s, duplicate Teams messages) Your job: 1. **Classify failures** — for each action, list how it can fail (transient, throttling, auth, bad data) and whether a retry is safe or would duplicate side effects. 2. **Try/Catch scopes** — propose a Scope structure (Try / Catch / Finally) using configure-run-after so failures are caught instead of silently terminating the run. 3. **Retry policy** — set per-action retry counts, intervals, and exponential vs fixed strategy, and flag actions where automatic retry must be disabled to avoid duplicate Teams posts. 4. **Idempotency** — design dedupe keys or guard checks so a re-run or retried action does not post the same alert or trigger the same approval twice. 5. **Failure surface** — define the Catch behavior: notify a fallback Teams channel, write to a log, and return a non-silent failure with enough context to debug. Output as: (a) failure classification table, (b) the scope/run-after structure described step by step, (c) per-action retry settings, (d) the Catch-branch notification design. When in doubt about whether a retry is safe, treat the action as non-idempotent and gate it behind a dedupe check rather than risking duplicate notifications.