Skip to article
Orvus.

The journal

Exception handling in automation: a practical process

Classify failures, make retries safe and give every unresolved exception an owner and a recovery path.

Hands sketching a workflow diagram on a desk.

The exception handling process is how an automated workflow detects an error, classifies it, takes a safe action (retry, compensate, or stop), and records what happened so the right person can recover the work. In practice you design for three broad categories: transient failures that often succeed on retry, invalid input you must correct, and business exceptions that require a decision.

Core types you must distinguish

1) Transient failures (often safe to retry)

These include network timeouts, throttling and temporary service faults. A controlled retry with exponential backoff and a maximum attempt limit helps workflows recover without overloading systems, and you should stop or branch if retries exhaust. This pattern is supported in mainstream automation platforms with configurable retry policies and backoff settings (Employ robust error handling, Microsoft Learn). Examples of transient categories you may encounter in run histories include timeouts and throttling quotas (Cloud flow error code reference, Microsoft Learn).

2) Invalid input (do not auto-retry)

Bad or malformed data should not be retried automatically. Typical signals are 400 BadRequest or data-conversion errors, which indicate you must fix the payload or transform it before trying again (Cloud flow error code reference, Microsoft Learn).

3) Business exceptions (need a decision)

These occur when data violates a business rule (for example, two owners claim the same lead, or a contract is missing a required approval). The correct action is to route the item to a review or dead-letter queue with clear context, not to retry blindly.

A practical exception-handling process

1) Detect and classify

Group risky steps into a Try scope and direct failures into a Catch scope that extracts the error, labels it, and chooses a path (Employ robust error handling, Microsoft Learn). Many designers also use run-after rules so specific actions fire only on failure or timeout (Microsoft Learn).

Person pointing to a four-stage process on a whiteboard.

2) Choose a safe action

3) Make retries safe with idempotency

If you retry, ensure the operation is idempotent: repeating it will not create duplicates or change state incorrectly. Use a stable operation key and the destination system’s supported idempotency mechanism. A timeout does not prove that the first request failed: check the saved operation status before repeating a write. An upsert alone does not make a separate email, payment or task creation safe to repeat.

4) Record and route for recovery

Capture a concise audit record: what failed, classification, correlation/run identifiers, who now owns it, and the next action. Some platforms let you construct a direct link to the failed run to speed diagnosis and handoff (Get flow run URL, Microsoft Learn). Send a focused notification instead of flooding inboxes (Log errors and notifications, Microsoft Learn).

Illustrative audit log entry (valid JSON)

{
  "eventId": "e-9384c8f2",
  "timestamp": "2026-10-28T14:05:17Z",
  "workflowName": "lead-handoff",
  "runUrl": "https://example.com/runs/12345",
  "classification": "transient-timeout",
  "operation": "assignOwner",
  "key": { "leadId": "L-10293", "targetOwnerId": "AE-447" },
  "retryCount": 2,
  "status": "exhausted-retries",
  "routedTo": { "queue": "revops-review", "owner": "[email protected]" },
  "notes": "HTTP 504 after 3 attempts with exponential backoff"
}

Example: handling exceptions in a lead handoff flow

Scenario: When marketing qualifies a lead, the automation assigns it to the correct account executive in the CRM and creates a follow-up task.

Monitor with code-like blocks and a separate status-log panel.

Design for the three categories

Safe retries and idempotency for handoff

  • Use a stable handoff-event ID, with the lead and intended owner recorded as context. Check the current record version before changing ownership, so replaying an older handoff cannot overwrite a newer decision. Apply the destination’s supported deduplication or idempotency mechanism separately to task creation.
  • After max retries, dead-letter to the RevOps review queue and create a single ticket with the same correlation ID.
  • Record the run URL and failure details to your error log store and include that link in the ticket (Construct run URL and log, Microsoft Learn).

If lead quality or routing rules are unclear, align this flow with your qualification criteria (What does lead qualification mean?).

Controls that prevent runaway or silent failures

Ownership and recovery

Every exception path should name an owner (team or role), a place to find the item (review/dead-letter queue), and a recovery play (fix data and requeue; manual completion; or rollback). Include service-level targets for acknowledgment and resolution in your runbooks.

Design your exception handling for lead handoff

FAQ

What makes an error safe to retry?

Errors tied to temporary conditions like timeouts or throttling are often safe to retry if your operation is idempotent and you cap attempts with exponential backoff (Retry policy guidance, Microsoft Learn).

How do I help someone fix a failed run quickly?

Include a direct link to the run, a short reason code, and the key identifiers in your notification and log. Many platforms let you construct a run URL for this purpose (Get flow run URL, Microsoft Learn).

Orvus logo

A useful next step

For a more technical explanation of deduplicating API writes, read Stack & Method’s guide: Idempotency keys: safe retries without duplicate actions.

Sources and further reading