Configure workflow error handlers
Learn how to handle errors .
As you build workflows of increasing complexity that interact with more data sources, it's important to handle errors and debug unexpected behavior effectively. You can configure blocks to function as error handlers and perform actions should any errors occur during the run.
Supported block types
You can configure the following block types to operate as global error handlers that execute if an error occurs anywhere during a workflow run. Note that workflows continue to run even after an error is triggered.
- Resource query
- AI action
- JavaScript or Python Code
- Loop
- Response
Configure a block to be an error handler
To configure a block for error handling, click ••• and select Add global error handler. Error handlers do not need to be part of the control flow and will execute if the workflow detects an error.
Retry failures automatically
For more granular error handling, you can configure error handlers to automatically execute again. This allows your workflow to automatically retry failed blocks with a specified schedule. Setting an exponential backoff can be especially useful for retrying blocks that query rate-limited APIs or data sources.
To configure retry settings, select Settings on the block. See the block settings, e.g., Resource query settings, to learn more.
Retrieve the workflow error details
You can reference workflowContext anywhere in your workflow to include workflow details. For example, you can get the workflow name using {{ workflowContext.name }}
. This can be useful for distinguishing between workflows that send notifications or including details about when the workflow's actions were last completed.
If a workflow fails, Retool makes the error information available at workflowContext.currentRun.error.message
. You can use this when configuring an error handler to log errors from the current run. For example, a Response block can return a 500
status with the error message.
Review and debug runs
You can use Ask AI to debug JavaScript, SQL, or GraphQL queries using AI-powered debugging.
Retool logs every successful and failed run of a workflow. Click Run history in the status bar to debug workflows. The Run history panel contains a list of recent runs, each with their date, time, their status. You can then view the status of each block to see where a failure may have occurred.
Run logs can help troubleshoot problems with queries, such as malformed SQL statements or invalid JavaScript. You can filter log entries to show only error, success, or info entries. Keep in mind that queries are considered successful if they didn't return an error. A workflow cannot determine if its actions produced the results you expected.
Admins can enable and update the retention period for Run History data from Settings > Advanced > Workflows: Enable Data Retention. The default retention period is 30 days, and the maximum retention period is 90 days.
Monitor usage with run logs
Retool calculates workflow usage and billing based on runs. You can view information about workflow runs by reviewing the logs.