# What's going on here - switch node

**URL:** <https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269>\
**Category:** General\
**Created:** [5 October 2025 04:34 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269 "2025-10-05T04:34:12Z")\
**Posts on this page:** 6\
**Page:** 2

<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:** [5 October 2025 08:09 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/21 "2025-10-05T08:09:58Z")

</div>

I think I know what's going on. It's the payload attribute. Do this:

1. create inject node and set the payload attribute to something
2. add a second attribute and call it payload aswell, set it to a different value

 ![Screenshot 2025-10-05 at 10.07.51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1148fa25cc9cb3b7f6189130513d66d260ac208.png)

1. Close the edit panel with done
2. open the edit panel and the payload value is the same:

 ![Screenshot 2025-10-05 at 10.08.23](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d8ed9d0646c1a9bf07fdc3129f7c636ccf20ade.png)

That's because the `payload` attribute is handled separately in the inject node:

```auto
[
    {
        "id": "fec30d0fd480bbf4",
        "type": "inject",
        "z": "5c82c4b32e500961",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "snafu", // <<<<<--------- payload can only have one value
        "payloadType": "str",
        "x": 1180,
        "y": 623,
        "wires": [
            []
        ]
    }
]

```

it's probably something similar in the switch node - the attribute being used is also called `payload` in the example here.

EDIT: damn, just checked - it's not!

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 October 2025 08:14 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/22 "2025-10-05T08:14:21Z")

</div>

Honestly, I can't say.

I just _noticed_ it when I was trying to use the second output and wasn't getting it.

So I opened the node and saw the anomaly.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 October 2025 08:17 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/23 "2025-10-05T08:17:08Z")

</div>

Wow, that is smart. Even if wrong. No offense.

How you analised the situation and made a test bed.

I'll give it a go just for the fun of it and get back to you.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 October 2025 08:19 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/24 "2025-10-05T08:19:50Z")

</div>

Sharing.

```auto
[
    {
        "id": "d2c1c0ab4e2a80d5",
        "type": "inject",
        "z": "b25fd092.bcc758",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "bar",
        "payloadType": "str",
        "x": 2950,
        "y": 2000,
        "wires": [
            []
        ]
    }
]

```

Alas the `foo` did get lost when I closed the `inject` node.

When I reopened it both lines were `bar`. `foo` had gone.

---

<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:** [5 October 2025 08:34 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/25 "2025-10-05T08:34:27Z")

</div>

> [@Trying\_to\_learn](#):
>
> Wow, that is smart. Even if wrong. No offense.

I had this situation with the inject node a while back but I assumed it's a known issue and there isn't anything that can be done - because of backward compatibility.

I had it because I sometimes add the same attribute multiple times to have different values (for testing). I then only need to move the defintions up and down using the drag & drop in the inject node instead of replacing the value - by typing. I was going to do this with the payload attribute and discovered this bug ...

It's a pity that's its not the fix for the switch node 😉

No offence taken!

---

<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:** [3 January 2026 13:29 UTC](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269/27 "2026-01-03T13:29:39Z")

</div>

Closed on 3 January 2026 13:29 UTC

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

[Previous page](https://discourse.nodered.org/t/whats-going-on-here-switch-node/99269.md?page=1)
