Split in Batches flow stops in the middle of the executions -- how to debug?

Describe the issue/error/question

I have a Split in badges flow that has two main avenues to take (Switch 1). While Avenue 1, with a break of 90 seconds between executions has never stopped out, Avenue 0 with 15 seconds break between executions has never iterated over all the elements, it stops between 7 and 15 elements and never arrives at the end.

What is the error message (if any)?

From the error workflow I know that the error apparently happens in node: “less than 90m - 15sec break between users”.

Please share the workflow

{
  "meta": {
    "instanceId": "X"
  },
  "nodes": [
    {
      "parameters": {
        "resource": "mail",
        "fromEmail": "X",
        "fromName": "X",
        "toEmail": "={{ $node[\"SplitInBatches1\"].json[\"email\"] }}",
        "dynamicTemplate": true,
        "templateId": "X",
        "dynamicTemplateFields": {
          "fields": [
            {
              "key": "expression",
              "value": "={{ \"X" ;}}"
            }
          ]
        },
        "additionalFields": {}
      },
      "name": "SendGrid Send Mail2",
      "type": "n8n-nodes-base.sendGrid",
      "typeVersion": 1,
      "position": [
        4620,
        740
      ],
      "id": "X",
      "credentials": {
        "sendGridApi": {
          "id": "2",
          "name": "X"
        }
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {
          "reset": false
        }
      },
      "name": "SplitInBatches1",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        4620,
        -180
      ],
      "id": "fc8ed04d-ff86-40e2-a75c-000000000"
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$node[\"SplitInBatches1\"].context[\"currentRunIndex\"];}}",
              "operation": "notEqual",
              "value2": "={{ $item(\"0\").$node[\"SplitInBatches1\"].json[\"numberOfContacts\"] }}"
            }
          ],
          "boolean": []
        }
      },
      "name": "IF3",
      "type": "n8n-nodes-base.if",
      "position": [
        4860,
        940
      ],
      "typeVersion": 1,
      "id": "68990575-b139-4a9d-8115-000000000"
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": true,
              "value2": "={{$node[\"SplitInBatches1\"].context[\"noItemsLeft\"]}}"
            }
          ]
        }
      },
      "name": "IF4",
      "type": "n8n-nodes-base.if",
      "position": [
        4880,
        -180
      ],
      "typeVersion": 1,
      "id": "de6e9965-804e-4925-9329-00000000000"
    },
    {
      "parameters": {
        "chatId": "-00000000000",
        "text": "=X",
        "additionalFields": {}
      },
      "name": "admin warning end of flow",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        5180,
        -180
      ],
      "id": "2dfb163a-462e-48c8-8ee7-0000000000",
      "credentials": {
        "telegramApi": {
          "id": "3",
          "name": "X"
        }
      }
    },
    {
      "parameters": {
        "operation": "sort",
        "type": "random"
      },
      "id": "45c5b16a-3e02-4067-0000000000000",
      "name": "Item Lists",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        4400,
        -180
      ]
    },
    {
      "parameters": {
        "value1": "={{ $node[\"Calculate time to T\"].json[\"minutesToGame\"][\"minutes\"] }}",
        "rules": {
          "rules": [
            {
              "operation": "smallerEqual",
              "value2": 90
            },
            {
              "operation": "larger",
              "value2": 90,
              "output": 1
            }
          ]
        },
        "fallbackOutput": 0
      },
      "id": "4a272b74-4520-4fb0-955d-000000000",
      "name": "Switch1",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 1,
      "position": [
        4880,
        160
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $node[\"Calculate time to T\"].json[\"minutesToGame\"][\"minutes\"] }}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "id": "b7199a42-a63f-4894-8a12-000000000",
      "name": "object empty?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        4620,
        540
      ]
    },
    {
      "parameters": {
        "amount": 90,
        "unit": "seconds"
      },
      "id": "465f4f8e-c5f7-4d6e-a87e-0000000000",
      "name": "more than 90m - 90sec break between users",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        5200,
        320
      ],
      "webhookId": "78be20f2-e9a8-4f90-a93b-000000000000"
    },
    {
      "parameters": {
        "content": "For some reason at after 11 emails it breaks with 10 secs, trying 15.\nOtherwise might need to send it right back without the wait node (why would that work though?)"
      },
      "id": "db60a5b7-752c-44c7-a3d6-000000000",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        5380,
        140
      ]
    },
    {
      "parameters": {
        "amount": 15,
        "unit": "seconds"
      },
      "id": "c8d19dba-9127-4cfc-bf61-0000000000",
      "name": "less than 90m - 15sec break between users",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        5200,
        140
      ],
      "webhookId": "faa688e4-bea8-4007-a80a-00000000000"
    }
  ],
  "connections": {
    "SendGrid Send Mail2": {
      "main": [
        [
          {
            "node": "object empty?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches1": {
      "main": [
        [
          {
            "node": "IF3",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF3": {
      "main": [
        [
          {
            "node": "SendGrid Send Mail2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF4": {
      "main": [
        [
          {
            "node": "admin warning end of flow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Item Lists": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "less than 90m - 15sec break between users",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "more than 90m - 90sec break between users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "object empty?": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "more than 90m - 90sec break between users": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "less than 90m - 15sec break between users": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Share the output returned by the last node

[
  {
    "messageId": "PxFjM5ZdQE-OOZHaV2M1Mg"
  }
]

Information on your n8n setup

  • n8n version: 0.213.0
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: main
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

Hey @somesimon,

That looks interesting, My initial thought is maybe the workflow is going wrong in the bit we can’t see and that is stopping the execution.

I am not sure why the workflow paste has gone wrong it normally shows a little preview of the workflow if it is valid, Could you share the workflow again?

Thanks so much for engaging @Jon, I removed PII fromt he flow, maybe I removed in the wrong spots as well.
I’ve tried to simply remove the time delay and that step where it fails for now, not my preferred setup, and will test that.

Will come back to this if I have more time!

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