Wait node causing multiple executions?

I’ve been trying to figure this out for two days and nothing is working. In my automation I have a wait node configured to resume on a webhook call. The loop over batches node that comes before it is pushing one lead through the loop, it makes a api call to Vapi to make a call and then the Wait2 node receives the end of call data and updates the google sheets at the end of the flow.

The flow in general works very well. However, a problem I’m running into is that every time I run the automation the execution log looks like it’s running anywhere from 2-5 executions. The only reason I can think why this is happening is because of something I overlooked/don’t know about how the wait node works when configured to resume on a webhook call.

If this was just a one off automation this wouldn’t be an issue. But I have this automation duplicated 10 times in my instance for my 10 clients. And even though I’m on the Pro-2 plan which allows for 50 concurrent executions I’m seeing my automations go into a queue which tells me I’m hitting my concurrency peak off these 10 clients. This is a big problem because it’s blocking my other automations from running that Vapi relies on during the calls (book a meeting, check calendar, etc.)

Here’s a picture of what the execution log looks like when the automation is running: https://share.zight.com/8Luzor9B

I can’t share the automation in this post because it says I go over the character limits, but here is a picture of the section of the workflow that houses the wait node

Pleeeeeeeease help me out if you have any idea whats going on! This has been such a frustrating experience.

Information on your n8n setup

  • n8n version: Version 1.122.5
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: macOS

The waiting maybe not coming from wait node

Might come from some node you used Human in the loop send and wait for response.

So the workflow is waiting for user input something to continue.

Hey @darrell_tw thank you for the response! I don’t have any nodes in this flow that require human in the loop unfortunately.

Hey @dmo1innovate !

If you are waiting for the “completed or ended” event from Vapi, i suggest to create another workflow(and set in VAPI the callBackUrl) … And once the call ends VAPI will send a to your webhook the response (actually this is the way to do it, instead sending ‘n’ requests to Vapi and see if the call ends), and that’s why your workflow runs multiple times…

Cheers!

Hey @Parintele_Damaskin! Thanks for the response. I considered having a separate webhook response workflow but the issue is that it would explode the execution count. Each client is making 150 calls a day so that would produce 150 execution of the webhook response workflow. Take that and multiply it by 10 clients every day for 30 days and I’m already pushing the limits of my Pro-2 plan (50k monthly executions).

The flow actually works completely fine and does everything it’s intended to do. I’m just confused why the execution log shows multiple executions running simultaneously when it should just be processing each item in the batch one at a time via one execution.

Ok… I understand.

Is like you are seeing “ghost” executions?

Or duplicates?

Or the fact that there are “waiting” (PENDING) execution s?(couse this happens when workflow has Wait node), it gets only the slot, but not counting as execution until is processed.

Without more context (more images with your “spaghetti” workflow, and preferably from execution tab so we can “see” the item/s flowing)…

Cheers!

Maybe this is related to the bug mentioned here?

1 Like

I can confirm that this issue is resolved in master.

Thanks everyone for you responses. I finally figured it out so I’m going to leave a rather long winded answer in case anyone else is trying to figure this out in the future (or a LLM that someones using picks up on this response).

High level - the problem was a mixture of what Vapi sends over during and at the end of the call and how n8n handles batches of incoming webhooks.

Vapi

Even if you set the server messages as ‘end of call report’ only, Vapi will still sometimes send a ‘status update’ server message even when you explicitly tell it not to. I manually reviewed close to 1,000 calls and this is what i found from the most common ‘endedReason’ values when I only had ‘end of call report’ configured in the server messages.

  • “Twilio failed to connect call”:
    • ‘End of call report’ = 66% of time
    • ‘Status update’ = 33% of time
  • “Customer busy”
    • ‘End of call report’ = 50% of time
    • ‘Status update’ = 50% of time
  • “Customer did not answer’“
    • ‘End of call report’ = 63.2% of time
    • ‘Status update’ = 36.8% of time
  • “Silence timed out”
    • ‘End of call report = 100% of time
  • “Customer Ended Call”
    • ‘End of call report’ = 100% of time
  • “Voicemail”
    • ‘End of call report’ = 100% of time

So, basically Vapi elects to still send a ‘status update’ webhook in call scenarios that don’t involve the customer actually picking up the phone even if you told it not to in the server messages. What I found helped reduce these percentages is to set the server messages in the assistant overrides of the API call you make to vapi instead of directly in the assistant dashboard found in the Vapi UI. It looks something like this:

“serverMessages”: [
“end-of-call-report”
],
“server”: {
“url”: “{{ $execution.resumeUrl }}”,
“timeoutSeconds”: 20
}

However, this still doesn’t totally eliminate the possibility of a ‘status update’ being sent over when you don’t want it. And that’s where the n8n configuration comes into play…

N8N

Important to note - What I built is a monolithic workflow. I know most people separate their workflows into two pieces for these types of builds … The first flow initiates the call, the second flow usually starts with a webhook and receives the end of call data. However, for those of you on a cloud hosted plan the two workflow approach doesn’t bode well for your monthly execution limits. This is because with that approach you’re, at a bare minimum, doubling the amount of monthly executions you’ll have.

The automation I built handles the call initiation and the end of call digestion all in one. To make this possible I used a wait node that resumes on a webhook call somewhere near the middle of the workflow (this node is what accepts the ‘status update’ or ‘end of cal report’ webhook from vapi). The webhook being called isn’t a static webhook like you’re used to seeing inside the webhook trigger node, but instead it’s the execution specific webhook which looks like this: {{ $execution.resumeUrl }}. When you send this over in your Vapi API call that actually makes the call (see the sample JSON body above), it changes the webhook destination to that particular executions wait node (assuming the wait node is configured to resume on webhook call).

After the wait node, you just need a simple switch node that determines what kind of webhook was received. And, depending on what webhook was received, you either loop the output of the switch node back to the wait node so that it resumes waiting for the correct type of webhook response, or you move it into another Vapi api call that retrieves the end of call report for that particular call ID.

Here’s a picture of what that flow looks like:

And here’s a picture of the configuration for ‘Webhook Received?’ switch node:

Since both the ‘end of call report’ and ‘status update’ webhook responses have the call ID this switch configuration makes it so that whatever passes through the ‘Yes’ and ‘Status Update - Ended’ arms will successfully be able to get the end of call reports from the downstream “Get End of Call Report” HTTP nodes.

Lastly (and this part is important)

For those of you that plan on running high volume of calls in parallel you should know that all n8n plans that aren’t Enterprise process webhooks sequentially instead of in parallel. Basically, this means n8n processes one webhook at a time instead of all at once, and this severely slows everything down. This is a hard limitation that you can’t change (unless you’re on the Enterprise plan) and it basically makes it impossible for the other Vapi automations in n8n that are triggered by webhooks (i.e. book a time on calendar, check availability, etc.) to run in a timely manner.

To solve this you need to set up a self hosted instance. I recommend using Railways pre-packaged n8n deployment (the one that has like 95k+ stars). It has configurable workers (which is what you’ll need to process webhooks in parallel instead of one at a time) and it took me all of 15 minutes to setup (pro tip: setup railways MCP in Claude and it can do debugging and configuration for you very easily). This was my first time ever setting up a self hosted instance and it was surprisingly easy. Costs are super cheap too. Btw none of this last part is an ad, I’m just explaining what I did and how it worked out for me.

Hope this helps!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.