What is the best way to handle "Service unavailable" for N8N's AI nodes
I’m building an n8n workflow that uses AI nodes, specifically Google Gemini and Claude, as part of a long SEO research and content brief generation process.
The issue I’m trying to handle more effectively is temporary AI model failures like this:
```
Service unavailable - try again later or consider setting this node to retry automatically.
This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.
```
The problem is that this error is usually temporary, but when it happens, it can break the whole workflow execution. Since the workflow has already completed several expensive/research-heavy steps before reaching the AI node, I lose a lot of progress and often have to re-run the entire workflow manually. The retry option is on but the max is 5 attemps every 5 seconds and some time this is not anough time for the service to restore...
I’m currently using n8n self-hosted version 2.22.4.
What I’m considering is this approach:
1. Enable **Continue On Error** on the AI node.
2. Send the error branch to a **Code node**.
3. In the Code node, detect whether the error is a temporary/retryable error, such as:
* service unavailable
* high demand
* try again later
* timeout
* 429 / 503 errors
4. If the error is retryable and the retry count is below a maximum number of attempts, send the item to a **Wait node** and then back to the AI node.
5. If the error is not retryable, or the max number of attempts has been reached, either stop the workflow or mark the item as failed.
6. I’m also thinking about moving this logic into a reusable **sub-workflow**, so I can use the same “safe AI call” pattern across multiple AI nodes.
My main question is:
* How do experienced n8n users usually prevent losing progress when an AI node fails after several previous research steps have already completed?
My goal is to make the workflow resilient, avoid repeating expensive research steps, and only retry the AI generation part when the error is temporary.
0
2 comments
Orestes Monteagudo
1
What is the best way to handle "Service unavailable" for N8N's AI nodes
Automate What Academy
skool.com/automate-what-academy
Get paid to build AI solutions, no tech background required.
Leaderboard (30-day)
Powered by