I think we are talking about different things.
This is my subflow.
[{"id":"a29b660bf678ae94","type":"subflow","name":"offline","info":"2024 02 10\n==========\n\nInput:\n------\n\n`topic` is the IP address\n\n`payload` is anything - but usually\nthe `nmap` responce time.\n\n`delay` needs to be set to a value\nto control the timeout period\n\nWill now throw an error if not set.\n\nOutput:\n------\n\n`ip_address` is the last 2 octets of\nof the IP address.\nUsed if the indicator needs this.\n\nSTATUS:\n------\n\nShows device status.\n\n\n\n2022 12 27\nHopfully better working.\n\n2022 12 26\n`msg.ip_address` is the last 2 octets\nof the IP address.\n","category":"","in":[{"x":100,"y":140,"wires":[{"id":"10d89115b954c0e5"}]}],"out":[{"x":970,"y":140,"wires":[{"id":"f7a5739094e4627b","port":0}]}],"env":[],"meta":{},"color":"#DD4040","icon":"node-red/status.svg","status":{"x":970,"y":290,"wires":[{"id":"4ad44ebed6115a2a","port":0}]}},{"id":"8dcd00765893e1a1","type":"trigger","z":"a29b660bf678ae94","name":"OffLineA","op1":"","op2":"Off-line","op1type":"nul","op2type":"str","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":650,"y":180,"wires":[["6f013d1da2275af3","f7a5739094e4627b"]]},{"id":"27779426545d8713","type":"trigger","z":"a29b660bf678ae94","name":"OffLineB","op1":"","op2":"Off-line","op1type":"nul","op2type":"str","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":650,"y":220,"wires":[["7fb1ac33c4a9d845"]]},{"id":"6f013d1da2275af3","type":"change","z":"a29b660bf678ae94","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"msg.delay / 2","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":220,"wires":[["27779426545d8713"]],"l":false},{"id":"06decc75cc1be73b","type":"switch","z":"a29b660bf678ae94","name":"Not `BOOT SIGNAL`","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"BOOT SIGNAL","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":535,"y":140,"wires":[["f7a5739094e4627b"]],"l":false},{"id":"7fb1ac33c4a9d845","type":"trigger","z":"a29b660bf678ae94","name":"OffLineC","op1":"","op2":"","op1type":"pay","op2type":"pay","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":810,"y":220,"wires":[["f7a5739094e4627b"]]},{"id":"f7a5739094e4627b","type":"function","z":"a29b660bf678ae94","name":"ip_address","func":"var y = msg.topic.substring(7);\nmsg.ip_address = y;\nnode.status({ text: msg.payload });\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":140,"wires":[[]]},{"id":"58c43f990cfcc4ed","type":"status","z":"a29b660bf678ae94","name":"IP_address","scope":["f7a5739094e4627b"],"x":400,"y":290,"wires":[["d05b7d56d254176c"]]},{"id":"d05b7d56d254176c","type":"change","z":"a29b660bf678ae94","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"status.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":290,"wires":[["4ad44ebed6115a2a"]]},{"id":"4ad44ebed6115a2a","type":"function","z":"a29b660bf678ae94","name":"function 7","func":"if (msg.payload == \"Off-line\") {\n msg.payload = ({ fill: \"red\", text: \"Offline\" });\n}\nif (msg.payload == \"On-line\") {\n msg.payload = ({ fill: \"green\", text: \"Online\" });\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":290,"wires":[[]]},{"id":"10d89115b954c0e5","type":"function","z":"a29b660bf678ae94","name":"Check msg.delay exists","func":"if (msg.delay == undefined)\n{\n throw \"msg.delay must be set\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":140,"wires":[["06decc75cc1be73b","8dcd00765893e1a1"]]},{"id":"9e8a6ffda39f4476","type":"subflow:a29b660bf678ae94","z":"c636aa5a.cc34","name":"","x":465,"y":830,"wires":[["61c14247.5f3384"]],"l":false}]
Being a subflow, it has many/multiple appearances in my flows.
It needs a msg.delay
to be in the incoming message.
So I put a code in there that if the msg.delay == undefined
it throws an error.
Of course that is good, but can you see the problem?
I don't get told from WHICH ONE the error is coming.
I'm stupid, I can't see/understand what your code is supposed to do.