# Cloning behavior

**URL:** <https://discourse.nodered.org/t/cloning-behavior/7054>\
**Category:** General\
**Created:** [20 January 2019 16:59 UTC](https://discourse.nodered.org/t/cloning-behavior/7054 "2019-01-20T16:59:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [20 January 2019 16:59 UTC](https://discourse.nodered.org/t/cloning-behavior/7054/1 "2019-01-20T16:59:42Z")

</div>

While playing with debug nodes I get the feeling that simply adding a debug node seems to change the msg passing (against my beliefs). When triggering the first flow I see the property `msg.res` being deleted (apparently) resulting in `undefined` being displayed in the debug panel. The second flow is the same as the first one, except that I unwired the first debug node. When triggering this second flow the debug panel reveals that `msg.res` holds the expected value. I am aware that adding a second wire to the function node will result in cloning of the message but was not expecting a property being removed (if this is indeed the case). Also, it is puzzling is that sometimes I can not repeat this behavior when creating everything from scratch. Can someone test the flow and tell me if you can observe the same behavior?

![r-01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e5f50badcfe0be93134ab2e015b0b1392d9f1a11.png)

```auto
[{"id":"16a4fcea.3bbe53","type":"tab","label":"Cloning","disabled":false,"info":""},{"id":"31fb332.03249cc","type":"inject","z":"16a4fcea.3bbe53","name":"G","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":80,"wires":[["6ab2295a.411b08"]]},{"id":"c5781ff8.01f48","type":"debug","z":"16a4fcea.3bbe53","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","x":530,"y":80,"wires":[]},{"id":"6ab2295a.411b08","type":"function","z":"16a4fcea.3bbe53","name":"msg.res = false","func":"msg.res = false;\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":80,"wires":[["c5781ff8.01f48","657870dd.cc5db"]]},{"id":"657870dd.cc5db","type":"debug","z":"16a4fcea.3bbe53","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"res","targetType":"msg","x":540,"y":140,"wires":[]},{"id":"fd8b9eb7.02fbc","type":"inject","z":"16a4fcea.3bbe53","name":"G","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":280,"wires":[["36ee1ed9.3ed082"]]},{"id":"a75f727f.b2413","type":"debug","z":"16a4fcea.3bbe53","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","x":530,"y":280,"wires":[]},{"id":"36ee1ed9.3ed082","type":"function","z":"16a4fcea.3bbe53","name":"msg.res = false","func":"msg.res = false;\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":280,"wires":[["85a0f428.9dffb8"]]},{"id":"85a0f428.9dffb8","type":"debug","z":"16a4fcea.3bbe53","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"res","targetType":"msg","x":520,"y":340,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 January 2019 17:10 UTC](https://discourse.nodered.org/t/cloning-behavior/7054/2 "2019-01-20T17:10:56Z")

</div>

You've hit an edge case here.

The clone function we use explicitly does _not_ clone `msg.req` and `msg.res` - they are well known properties used by the `HTTP In` node which cannot be cloned.

Try you tests again with literally any other property name and I suspect you'll find a much more consistent result.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [20 January 2019 17:22 UTC](https://discourse.nodered.org/t/cloning-behavior/7054/3 "2019-01-20T17:22:00Z")

</div>

Indeed, testing with another name property works perfectly, which also explains why I could not reproduce the issue in my second attempt (I selected another property name at random). Thank you very much Nick.
