# Process flow run failures

## Introduction

A process flow may fail for a number of reasons - for example, if a mapped field in the source/destination system has changed unexpectedly; if authentication credentials for a connection have expired, or if shape configuration is incorrect.

You might notice the failure whilst observing [real-time logs as a flow is run manually](https://doc.wearepatchworks.com/product-documentation/process-flows/error-reporting-and-exception-handling/real-time-run-logs), or you might have received an [email alert](https://doc.wearepatchworks.com/product-documentation/process-flows/error-reporting-and-exception-handling/email-notifications-for-failed-process-flow-runs) advising that an [auto-triggered](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/trigger-shape) process flow failed to complete.&#x20;

This guide summarises what to do in the event that a process flow fails.

{% hint style="info" %}
When a process runs and fails, it's re-tried three times automatically before being stopped and logged as a failure.
{% endhint %}

## Handling a process flow run failure

**Step 1**\
Check the [run logs](https://doc.wearepatchworks.com/product-documentation/process-flows/error-reporting-and-exception-handling/run-logs-and-queue) for the process flow. Here you'll find detailed information associated with each step in the flow, so you can identify which shape caused the flow to fail.

{% hint style="info" %}
If a process flow has failed at a [connection](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) step, consider the following:

* Are the **authentication credentials** provided for the selected connector instance still current? If you need to update credentials, you can [edit the instance](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/updating-an-instance).&#x20;
* Are all **connection shape settings** correct? For example, could the issue be related to a variable or parameter (either missing or defined incorrectly)?&#x20;
* Is the **third-party system** associated with your connector instance experiencing any issues?
* Is the connector instance associated with a custom connector that was built by someone in your own organisation using [connector builder](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder)? If yes, check that the **data schema** for the endpoint selected in your [connection](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) step is valid.
  {% endhint %}

{% hint style="warning" %}
If you change credentials for an instance, those credentials will be updated in all process flows where that instance is defined.&#x20;
{% endhint %}

**Step 2**\
If the cause of the failure isn't obvious from the log details, [check the payloads](https://doc.wearepatchworks.com/product-documentation/error-reporting-and-exception-handling/run-logs-and-queue#view-logs) for each step in the flow to see if they are as expected. Payloads are available from the [run logs page](https://doc.wearepatchworks.com/product-documentation/process-flows/error-reporting-and-exception-handling/run-logs-and-queue), via the **view logs** option for each step:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fs9pfAGE7f6CvUntzJOEw%2Frun%20logs%20-%20view%20payload%20journey.png?alt=media&#x26;token=e4daf75a-f3cd-46fe-b89e-87c23535eea9" alt=""><figcaption></figcaption></figure>

**Step 3**\
If you've found the cause of the failure from the logs and need to update the process flow, access the process flow in question and make the required changes. \
\
**OR**\
\
If you haven't found the issue and need to investigate further, access the process flow in question and check the settings for each shape.&#x20;

**Step 4**\
Having updated the process flow, you may wish to [run it manually](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/initialising-a-process-flow-manually) to check that the issue is resolved or wait for the next scheduled run.
