# Single input to node, but unexpected triplicate outputs

**URL:** <https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896>\
**Category:** General\
**Created:** [12 October 2026 12:01 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896 "2026-10-12T12:01:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:01 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/1 "2026-10-12T12:01:58Z")

</div>

Hi everyone,

I have a weird error in Node-Red. In the flow below, I created counter nodes to show how many times messages are passed through the flow. I found that this is great tool for debugging complex flows that interact with PLCs.

You can see that the **IsGateBlocked** node was called once, but the output of the node fired 3 times. This is a potential deal breaker in industrial automation, and its completely unexpected.

The only workaround here was to add a filter node, but that does needlessly complicate the flow.

Please can you have a look at this and share any constructive thoughts on this topic?

I am running an old version of NR2.2 on the server, and not able to upgrade until December.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/914a7a819fd09ad64633574054424241d83211b5.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 October 2026 12:11 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/2 "2026-10-12T12:11:09Z")

</div>

Can you show us the contents of IsGateBlocked and your 123 function?

Export then and paste here.

Also what do the inbound messages look like?

---

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:21 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/3 "2026-10-12T12:21:03Z")

</div>

Hi jbudd,

Thanks for looking at my post.

Here is a screnshot of the node content:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/104576767541bd2eef71ea1f4e750739a33af38a.png)

---

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:22 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/4 "2026-10-12T12:22:04Z")

</div>

I left out the bottom part....

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c6d627f58b22ead7d6cb23d743da06600a52ab5.png)

---

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:23 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/5 "2026-10-12T12:23:18Z")

</div>

[{"id":"6da85ff772e08cfa","type":"switch","z":"0f2ee729476aa90a","name":"IsGateBlocked","property":"blocked","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"false","repair":false,"outputs":1,"x":2140,"y":900,"wires":[["93b173faae9a2cea","bcd5b7bc0ff2a4ef"]]}]

---

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:38 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/6 "2026-10-12T12:38:17Z")

</div>

And here is my counter node:

[{"id":"bcd5b7bc0ff2a4ef","type":"function","z":"0f2ee729476aa90a","name":"Counter","func":"var counter = context.get('counter') || 0;\n\nif(msg.reset){\n counter = 0;\n node.status({\n fill:'gray',\n shape:'dot',\n text: counter\n }\n );\n\n delete msg.reset;\n\n}else{\n counter++;\n node.status({\n fill:'blue',\n shape:'dot',\n text: counter\n }\n );\n}\ncontext.set("counter",counter);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set("counter", 0);\nnode.status({\n fill: 'gray',\n shape: 'dot',\n text: 0\n}\n);","finalize":"","libs":,"x":2285,"y":780,"wires":[],"outputLabels":["Off"],"icon":"node-red-dashboard/ui\_numeric.png","l":false}]

Here is a view of the the input ... a single message.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fa8e3d6e4f9e220e80a59eee79366c7e543e0358.png)

---

<div class="post-metadata">

**Author:** ![mudwalker](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mudwalker](https://discourse.nodered.org/u/mudwalker)\
**Post date:** [12 October 2026 12:39 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/7 "2026-10-12T12:39:01Z")

</div>

DIscord does things to pasted flows so they cannot be copy and pasted. You need to add ``` to the beginning and the end of the flow. See this link [How-to-share-code-or-flow-json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506).

---

<div class="post-metadata">

**Author:** ![mikky\_thomeon](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mikky\_thomeon](https://discourse.nodered.org/u/mikky_thomeon)\
**Post date:** [12 October 2026 12:44 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/8 "2026-10-12T12:44:06Z")

</div>

Sorry about the formatting, here is a version that should work based on the Discord guidelines.

```flows

[{"id":"b68d2bbddc2bf805","type":"rbe","z":"0f2ee729476aa90a","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1850,"y":860,"wires":[["29095af57cab2664","4b11dfde59ac9c7d","bd0ccd2cda026804"]]},{"id":"bd0ccd2cda026804","type":"function","z":"0f2ee729476aa90a","name":"Counter","func":"var counter = context.get('counter') || 0;\n\nif(msg.reset){\n counter = 0;\n node.status({\n fill:'gray',\n shape:'dot',\n text: counter\n }\n );\n\n delete msg.reset;\n\n}else{\n counter++;\n node.status({\n fill:'blue',\n shape:'dot',\n text: counter\n }\n );\n}\ncontext.set(\"counter\",counter);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"counter\", 0);\nnode.status({\n fill: 'gray',\n shape: 'dot',\n text: 0\n}\n);","finalize":"","libs":[],"x":2035,"y":780,"wires":[[]],"outputLabels":["Off"],"icon":"node-red-dashboard/ui_numeric.png","l":false},{"id":"4b11dfde59ac9c7d","type":"switch","z":"0f2ee729476aa90a","name":"Validation Check2","property":"status","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"},{"t":"eq","v":"DUPLICATE","vt":"str"},{"t":"eq","v":"QC FAILED","vt":"str"},{"t":"eq","v":"RETRYING","vt":"str"},{"t":"eq","v":"NOREAD","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":2030,"y":1060,"wires":[["be7947ecf2ba01f6","be7947ecf2ba01f6","be7947ecf2ba01f6","be7947ecf2ba01f6","6da85ff772e08cfa","6da85ff772e08cfa","be7947ecf2ba01f6","be7947ecf2ba01f6","6da85ff772e08cfa","6e5a6f95502c1142","5818b8a9ec28b7a7"],["472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","77f41c4075cb82eb"],["472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","472c79a37374c11f","e5e9d68a0a3e413c"],["c3ad158299c664e5","c3ad158299c664e5","c3ad158299c664e5"],["472c79a37374c11f"]]},{"id":"6da85ff772e08cfa","type":"switch","z":"0f2ee729476aa90a","name":"IsGateBlocked","property":"blocked","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"false","repair":false,"outputs":1,"x":2140,"y":900,"wires":[["93b173faae9a2cea","bcd5b7bc0ff2a4ef"]]},{"id":"bcd5b7bc0ff2a4ef","type":"function","z":"0f2ee729476aa90a","name":"Counter","func":"var counter = context.get('counter') || 0;\n\nif(msg.reset){\n counter = 0;\n node.status({\n fill:'gray',\n shape:'dot',\n text: counter\n }\n );\n\n delete msg.reset;\n\n}else{\n counter++;\n node.status({\n fill:'blue',\n shape:'dot',\n text: counter\n }\n );\n}\ncontext.set(\"counter\",counter);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"counter\", 0);\nnode.status({\n fill: 'gray',\n shape: 'dot',\n text: 0\n}\n);","finalize":"","libs":[],"x":2285,"y":780,"wires":[[]],"outputLabels":["Off"],"icon":"node-red-dashboard/ui_numeric.png","l":false},{"id":"6e5a6f95502c1142","type":"function","z":"0f2ee729476aa90a","name":"Counter","func":"var counter = context.get('counter') || 0;\n\nif(msg.reset){\n counter = 0;\n node.status({\n fill:'gray',\n shape:'dot',\n text: counter\n }\n );\n\n delete msg.reset;\n\n}else{\n counter++;\n node.status({\n fill:'blue',\n shape:'dot',\n text: counter\n }\n );\n}\ncontext.set(\"counter\",counter);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"counter\", 0);\nnode.status({\n fill: 'gray',\n shape: 'dot',\n text: 0\n}\n);","finalize":"","libs":[],"x":2195,"y":960,"wires":[[]],"outputLabels":["Off"],"icon":"node-red-dashboard/ui_numeric.png","l":false}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 October 2026 14:34 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/9 "2026-10-12T14:34:05Z")

</div>

The only thing that I notice is that your `message.blocked` is a boolean, (as is `msg.payload[0].blocked`) but in the switch node you are comparing it against numeric zero.

It ought to work but I think it's clearer to use the `Is true` option in the switch node rather than` == 0`

It would be very odd indeed for the switch node to emit three outbound messages for a single input.  
If the change I suggested above doesn't fix it, I would insert a junction into the wire feeding `IsGateBlocked` and add a debug, set to output `msg.blocked`, looking for clues.

---

<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:** [12 October 2026 16:40 UTC](https://discourse.nodered.org/t/single-input-to-node-but-unexpected-triplicate-outputs/101896/10 "2026-10-12T16:40:37Z")

</div>

Add debug nodes to the flow showing the messages going in and out to see if there really are multiple messages for each input message.
