Split Out node — is weird!

Hello all,

I’m new to n8n (±3 months) and this is my first post here. Let me apologise in advanced if I have not entirely respected any forum/community habit/rules :folded_hands:t2:

Describe the problem/error/question

I am trying to use the Split Out node to perform an action: call a subprocess. For the sake of simplicity, I’ll try and send emails.

I want each of these emails to be sent at a specific time. So I included a Wait node which, again for the purpose of this post, takes the item ID value, multiplies it by 5 (seconds) and then send the Email.

What is the error?

The emails are never sent. The Wait node loops on itself by multiplies of 3 (number of items) until… well, I waited until it reached 36 but that did take some time.

The real version

The real version has a “Scheduler” Code node that generates 2 (or sometimes 3 – but the version pasted here has hardcoded test values) “delaySeconds” values, that are used for the Wait function. But what happens, is that all 2 (or 3) emails are sent at once, when the first one executes.

The only way I managed to make this work is to have 3 separate Wait nodes, one per item… But I feel it’s not the way n8n is supposed to work :sweat_smile:

In this case however, I do get emails at 5 sec, +2mn and also at +3mn (with a modified test Scheduler).

Sooo… if anyone can help me explain what really is happening, that’d be great!

Information on my n8n setup

  • n8n version: 1.104.1
  • n8n licence: Sustainable Use License + n8n Enterprise License
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker on Hostinger VPS
  • Operating system: Ubuntu 24.04

Hey @Florent14 hope all is well. Welcome to the community.

This is because your expression is wrong.

It should be:

{{ 5 * ($json.id - 1) }}

otherwise you are sending text to the number field

Silly me :sweat_smile:

Thanks a lot, this does work now.

Still, I wonder why I can’t get the “real” version to work.

If you pin some data for me to look at for the Code node, I can try to run an see what is what

The Code node has binary data so I can’t pin it. But here is the part of the JSON output that is used by the split:

[
  {
    "nowUTC": "2025-08-01T10:05:57.937Z",
    "localDate": "2025-08-01",
    "localTimeFormatted": "01/08/2025, 12:05:57",
    "timezone": "Europe/Paris",
    "workflowName": "DEV > Randomised Process Scheduler",
    "stateFileFullPath": "/files/n8n-projects-data/RPS/logs/state-2025-08-01.json",
    "logFileFullPath": "/files/n8n-projects-data/RPS/logs/planning-2025-08-01.txt",
    "timeSlots": {
      "morning": {
        "start": 6,
        "end": 12,
        "probability": 0.85
      },
      "afternoon": {
        "start": 12,
        "end": 18,
        "probability": 0.85
      },
      "evening": {
        "start": 18,
        "end": 24,
        "probability": 0.4
      }
    },
    "restartType": "FIRST_RUN",
    "plannedAt": "2025-08-01T10:05:57.937Z",
    "plannedAtLocal": "01/08/2025, 12:05:57",
    "plannedAtTimestamp": 1754042757937,
    "logContent": "EDITED",
    "needsStateUpdate": true,
    "needsLogUpdate": true,
    "action": "executions_planned",
    "executionCount": 3,
    "executions": [
      {
        "executionIndex": 1,
        "totalExecutions": 3,
        "slot": "test_5sec",
        "scheduledTime": "2025-08-01T10:06:02.937Z",
        "delayMs": 5000,
        "delaySeconds": 5,
        "delayHours": 0,
        "metadata": {
          "date": "2025-08-01",
          "hour": 10,
          "minute": 6
        }
      },
      {
        "executionIndex": 2,
        "totalExecutions": 3,
        "slot": "test_2min",
        "scheduledTime": "2025-08-01T10:07:57.937Z",
        "delayMs": 120000,
        "delaySeconds": 120,
        "delayHours": 0,
        "metadata": {
          "date": "2025-08-01",
          "hour": 10,
          "minute": 7
        }
      },
      {
        "executionIndex": 3,
        "totalExecutions": 3,
        "slot": "test_3min",
        "scheduledTime": "2025-08-01T10:08:57.937Z",
        "delayMs": 180000,
        "delaySeconds": 180,
        "delayHours": 0.1,
        "metadata": {
          "date": "2025-08-01",
          "hour": 10,
          "minute": 8
        }
      }
    ]
  }
]

Let me know if this is not enough. I’ll then try and modify the code.

I edited the logContent out, obviously.

Executions[] is the array on which the split is done. The Wait node uses “{{ $json.executions.delaySeconds }}” as Wait Amount.

The really weird thing to me, is that the split works out fine with 3 wait conditioned by the executionsIndex. If the executionsIndex value is different for each item (as it should be), why isn’t the delaySeconds?

I created a simplified version of my workflow, removing the binary files creation that prevented me from pinning the data:

Here is a copy of the emails I received:

ITEM DESCRIPTION #1
Slot: test_5sec
Time is: 2025-08-01T12:58:06.041+02:00 [at UTC+2 time]
Scheduled at: 2025-08-01T10:58:05.997Z [at UTC time]
Delay (sec): 5

ITEM DESCRIPTION #2
Slot: test_2min
Time is: 2025-08-01T12:58:06.564+02:00 [at UTC+2 time]
Scheduled at: 2025-08-01T11:00:00.997Z [at UTC time]
Delay (sec): 120

ITEM DESCRIPTION #3
Slot: test_3min
Time is: 2025-08-01T12:58:06.993+02:00 [at UTC+2 time]
Scheduled at: 2025-08-01T11:01:00.997Z [at UTC time]
Delay (sec): 180

As you can see, the execution time is (nearly) the same, when the scheduled time is as it should :sweat_smile:

This is what I would do. I would split this into two workflows. Attaching both on a single canvas, please separate into two and point the main one to the second one in the last node:

1 Like

Wow, this worked…

I’m non-plussed. I’m not sure why shifting the Wait node in a subprocess works, whereas having it straight after the Split Out node doesn’t.

It tends to mean the data structure that is outputed by the Code node is correct, so…

Anyway, since all I wanted to do was exactly to activate a subprocess, I’ve marked your proposition as a solution.

ITEM DESCRIPTION #1
Slot: test_5sec
Time is: 2025-08-04T13:56:04.647+02:00 [at UTC+2 time]
Scheduled at: 2025-08-04T11:56:04.523Z [at UTC time]
Delay (sec): 5

ITEM DESCRIPTION #2
Slot: test_2min
Time is: 2025-08-04T13:57:59.659+02:00 [at UTC+2 time]
Scheduled at: 2025-08-04T11:57:59.523Z [at UTC time]
Delay (sec): 120

ITEM DESCRIPTION #3
Slot: test_3min
Time is: 2025-08-04T13:58:59.743+02:00 [at UTC+2 time]
Scheduled at: 2025-08-04T11:58:59.523Z [at UTC time]
Delay (sec): 180

Thanks a lot @jabbson for the time spent helping me :folded_hands:t2:

I would love to have an explanation as to why it doesn’t work the way it’s supposed to, though!

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