Retry a failed run
Complex data flows will often create unexpected errors during runs that were not spotted prior to publishing a workflow version. These failed runs can be caused by transient API errors, unexpected changes in a data structure, or unhandled edge cases.
This guide will show you how to use Cargo's runs view in the workflow editor to find those failing workflow executions. Next, we'll spot the location of the problem, fix the workflow, and finally re-run failed runs to avoid any data loss.
In this example, we will run an enrichment tool on lead records and write results to the CRM. To do this we will trigger an edge-case where the workflow will fail and we will walk you through how to address the problem.
Used Features:
Before you begin
In this guide, we will use an existing workflow that upserts records to HubSpot. If you need help in setting up the workflow start with this guide: Upsert a company to Hubspot from within a workflow
From the form submission payload, we mapped one field which contains the country code (e.g FR
):
- country -> hs_country_region_code
This is what we receive from the form system:
{
"email": "tariq@getcargo.io",
"country": "FR"
}
Finding failed runs
With the slack health alert feature, we were notified that this workflow started to fail recently. To inspect what happened we open the workflow editor and click the "runs" tab.
We find runs with the error status, if we cannot quickly spot them on the list we can use the status filter to isolate these rows in the runs table.
Click the "expand" icon on the left side of any run that errored out. This will open up a workflow preview (non-editable) with the details of that specific run.
In this view, we can click the failed node, which is the HubSpot write action, and see details of the error.
In our case it it was the validation logic that rejected the payload. We can click the "In" tab on the node sidebar to see the exact values that were sent to HubSpot.
Here is the culprit:
- expected value:
FR
- actual value:
France
Which is not a country code and can't be saved in this field.
Fix Workflow logic
Now we can get back to the main workflow editor and fix the issue.
We have decided that since the value sent by the website changed from country code to full country name we will write it to a different,
correct HubSpot property called country
.
Once the logic is fixed we will publish it and rerun the failed runs. After publishing, head back to the "runs" tab at the top of the editor and select the failed runs we want to retry using a checkbox on the left side of the table.
Click the "retry" button in the top right and confirm it.
HINT: When retrying failed runs you have an option to reset them. When selected it will make the run start from the beginning and ensure it will go through the whole workflow again. By default, this is disabled and will only retry from the step the run failed.
Reload the "runs" view and shortly we should see all retried Runs appear as new entries in the table.
In our example, we can see they are now successful. To be certain about the fix we can inspect the payload sent to HubSpot.
Finish line
We have been able to quickly identify failed Runs. Inspect the details of the error and apply the path to the workflow logic.
Finally, we have rerun the failed "runs" which ensures there is no data lost and all intended changes were successfully made.