Retry on fail except for known error Template

用于n8n,通过自动重试机制处理失败的请求,智能识别已知错误,最大限度减少手动干预,确保流程高效运行。设置最大重试次数和等待时间,优化工作流的稳定性和可靠性。

7/4/2025
19 nodes
Complex
manualcomplexstopanderrorwaitnoopsticky noteadvancedlogicconditional
Categories:
Manual TriggeredComplex Workflow
Integrations:
StopAndErrorWaitNoOpSticky Note

Target Audience

This workflow is ideal for:
- Developers looking to implement retry logic in their applications.
- Data engineers who need to ensure data retrieval processes are robust against transient errors.
- Business analysts wanting to automate workflows that deal with known error scenarios without manual intervention.
- Operations teams managing critical data pipelines that require reliability and error handling.

Problem Solved

This workflow addresses the following issues:
- Transient errors: Automatically retries operations that fail due to temporary issues, thus increasing success rates.
- Known errors handling: It differentiates between known errors and other failures, allowing for appropriate responses without unnecessary retries.
- Retry limits: Prevents infinite loops by implementing a limit on the number of retries, ensuring system stability and resource management.

Workflow Steps

The workflow operates through the following steps:
1. Manual Trigger: Starts the workflow manually, allowing users to initiate the process when needed.
2. Set Tries: Initializes a counter for the number of attempts made to execute the operation.
3. Replace Me: This node represents the main operation that needs to be performed. If it fails, the workflow will handle it based on the error type.
4. Catch Known Error: Checks if the error returned is a known issue (e.g., 'could not be found'). If so, it routes to the Known Error node.
5. Wait: Introduces a delay before retrying the operation, allowing for transient issues to resolve.
6. Update Tries: Increments the attempt counter after each failure.
7. If Tries Left: Evaluates if the number of attempts is less than the defined maximum (default is 3). If attempts are left, it retries; if not, it proceeds to stop the workflow with an error message.
8. Retry Limit Reached: Stops the workflow and outputs an error message if the maximum retry limit is reached.
9. Success: If the operation succeeds, it proceeds to this node, indicating a successful workflow execution.

Customization Guide

Users can customize this workflow by:
- Adjusting the retry limit: Modify the value in the 'If Tries Left' node to change how many times the operation will retry before failing.
- Changing the wait duration: Update the parameters in the 'Wait' node to specify a different time before retries are attempted (default is 5 seconds).
- Replacing the main operation: Substitute the 'Replace Me' node with the actual data retrieval or processing node, ensuring it is configured to handle errors correctly.
- Modifying known error conditions: Adjust the conditions in the 'Catch Known Error' node to include other known error messages specific to the use case.