# Complete & Split: is the value wrong?

**URL:** <https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650>\
**Category:** Core Development\
**Tags:** possible-bug\
**Created:** [20 April 2025 08:07 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650 "2025-04-20T08:07:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 April 2025 08:07 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/1 "2025-04-20T08:07:22Z")

</div>

Hi There,

and sorry to go with this complete node topic but ....

 ![Screenshot 2025-04-20 at 10.03.04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8ff546ed1e91d5474810d7f145132cda85421d39.png)

```auto
[{"id":"801126629e8ab7c2","type":"inject","z":"14ef36ad590a7fe8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[1,2,3,4]","payloadType":"json","x":540,"y":740,"wires":[["43e9c21fa8e74c31"]]},{"id":"50914d4efa31df6e","type":"complete","z":"14ef36ad590a7fe8","name":"","scope":["43e9c21fa8e74c31"],"uncaught":false,"x":1008,"y":495,"wires":[["fa1a47e2ee058fb1"]]},{"id":"fa1a47e2ee058fb1","type":"debug","z":"14ef36ad590a7fe8","name":"debug 394","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1350,"y":336,"wires":[]},{"id":"3ed5963b7a8e8f57","type":"join","z":"14ef36ad590a7fe8","name":"","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1014,"y":740,"wires":[["ef44b9d6ea93685b"]]},{"id":"43e9c21fa8e74c31","type":"split","z":"14ef36ad590a7fe8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","property":"payload","x":792,"y":605,"wires":[["3ed5963b7a8e8f57"]]},{"id":"ef44b9d6ea93685b","type":"debug","z":"14ef36ad590a7fe8","name":"debug 395","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1322,"y":588,"wires":[]}]

```

This time the complete is listening to the split node which receives a message with `[1,2,3,4]` array of four values. It sends out four messages to the join. It also sends a message to the complete node but instead of sending the original array, it sends the value '4' i.e. the last value in the array:

 ![Screenshot 2025-04-20 at 10.04.58](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/49aa156fab54cf04d9a4d851f8265105b4d04b90.png)

Shouldn't that be the content of the original message, i.e. `[1,2,3,4]` since that's the message with which the split has completed with?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 April 2025 08:19 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/2 "2025-04-20T08:19:10Z")

</div>

hmm - possibly/probably yes. The idea of the complete node was to aid transactionality of flows - so that if either something broke halfway through or if a flow was asked to stop then you could possibly how far it had got and take steps to recover from that point... BUT that gets tricky around these case where a node does more than one thing... when is it really complete ? and indeed there are no doubt some inconsistencies in the existing implementations that could be thought through a bit more.

In this specific case I would need to check if it was sending 4 for the last item value or 4 for the number of items processed...

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 April 2025 08:32 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/3 "2025-04-20T08:32:05Z")

</div>

> [@dceejay](#):
>
> In this specific case I would need to check if it was sending 4 for the last item value or 4 for the number of items processed...

I added ten to the list and got 10 as complete message ... 😉

EDIT: I didn't add ten elements just the number 10 😉

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 April 2025 09:48 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/4 "2025-04-20T09:48:49Z")

</div>

yes - I see that - net is that I think I agree with you that in this case the complete node should really send the original input payload. I can raise a PR - but need to check with @knolleary where we raise it as it is a potentially breaking change (for someone).

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 April 2025 10:06 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/5 "2025-04-20T10:06:22Z")

</div>

> [@dceejay](#):
>
> potentially breaking change (for someone).

This edge case has a finer edge to it than any good Japanese Samurai sword ...

... and then the world bank collapses because they were checking the last value in an array.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 April 2025 10:40 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/6 "2025-04-20T10:40:07Z")

</div>

Even using a Complete node with a Split would be a very unusual thing to do I think. It is mostly of use with async nodes.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 April 2025 10:49 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/7 "2025-04-20T10:49:49Z")

</div>

Not if you had a query that returned an array of financial trades for example. You would want to split and track progress of each one.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 April 2025 10:55 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/8 "2025-04-20T10:55:49Z")

</div>

> [@Colin](#):
>
> Even using a Complete node with a Split would be a very unusual thing

folks do strange things and in particular banks.

I could well imagine someone asking how to get the last value of an array in a visual fbp way ... _well if we send the array to the split and then have a complete node listening to it we get the last value_ - 10 points for creativity, 0 for correctness!

EDIT: I'm definitely not questioning the usefulness of the complete node, just that one use case with split ....

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 April 2025 11:49 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/9 "2025-04-20T11:49:35Z")

</div>

> [@gregorius](#):
>
> folks do strange things and in particular banks.

Having worked in a couple of large UK banks on their IT, mostly there are only a couple of people in the bank who actually know how the financial processing actually works! 🙂 And those people are not financial people! I several times found myself with more knowledge than bank staff simply because I'd done some homework.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 April 2025 12:48 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/10 "2025-04-21T12:48:10Z")

</div>

Pull request raised [Let split node send original msg to complete node by dceejay · Pull Request #5113 · node-red/node-red · GitHub](https://github.com/node-red/node-red/pull/5113)

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [21 April 2025 12:56 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/11 "2025-04-21T12:56:23Z")

</div>

Btw I found the same issue with the status node - it filters direct nodes from which it will ignore status updates but if I put a change in-between the status and the node producing the status update, I've got an endless loop.

I.e. this setup:

 ![Screenshot 2025-04-21 at 14.53.56](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e5b011fe599f0b6305ad817a27bca10b9126fb3.png)

If I enable the change node and then trigger one of the injects, loop is created. Especially since the status is ever changing in the debug node 398 - it's a message counter, status each time now, status all sends out message, debug 398 counts that message, new status, status all captchas that status update and sends out a message, debug 398 counts that message, updates its status, status all captchas that update .... and I'm dizzy.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 April 2025 13:41 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/12 "2025-04-21T13:41:57Z")

</div>

Good shout - will apply same "simple" fix to status node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 May 2025 15:17 UTC](https://discourse.nodered.org/t/complete-split-is-the-value-wrong/96650/13 "2025-05-08T15:17:35Z")

</div>

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