# Selfconnectedness or how to connect a node to itself

**URL:** <https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174>\
**Category:** Core Development\
**Tags:** possible-bug\
**Created:** [6 February 2025 09:13 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174 "2025-02-06T09:13:05Z")\
**Posts on this page:** 11\
**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:** [6 February 2025 09:13 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/1 "2025-02-06T09:13:05Z")

</div>

Hi There,

I just noticed that nodes cannot be connected to themselves - probably very sensible.

However if I delete a connected node using the "maintain connections" (ctrl/cmd-delete/backspace) functionality, I can get a node to be connected to itself.

![selfconnectedness](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bf6413ff00f452540dcfddd76720027313bab3b1.gif)

When I export the node, the wire is included in the export, i.e., maintained.

Ironically I'm just making use of that feature! 🙂

(Tested with 4.0.5 & 3.1.9)

---

<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:** [6 February 2025 09:24 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/2 "2025-02-06T09:24:58Z")

</div>

Thanks for highlighting this bug. I'll be sure it gets fixed in the next maintenance release.

[https://github.com/node-red/node-red/issues/5038](https://github.com/node-red/node-red/issues/5038)

---

<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:** [6 February 2025 09:40 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/3 "2025-02-06T09:40:16Z")

</div>

Are you certain that it should not be possible to wire a node to itself? I have wanted to do this occasionally myself and have had to insert a junction to do it, which ends up with a messy looking flow.

---

<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:** [6 February 2025 09:46 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/4 "2025-02-06T09:46:01Z")

</div>

> [@Colin](#):
>
> have had to insert a junction to do it

I've tended to use a second function node because I did something there but using an junction node is far better - but not as good as the self loop function node (IMHO):

 ![Screenshot 2025-02-06 at 10.45.24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9a10361af7ef96e1009b0f1f9086271f23cde2b4.png)

---

<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:** [6 February 2025 09:48 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/5 "2025-02-06T09:48:11Z")

</div>

We chose to not allow self-loops as it was too easy to create infinite loops by mistake.

Requiring a second node, or junction, adds a little bit of friction and makes it a more intentional choice.

---

<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:** [6 February 2025 09:58 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/6 "2025-02-06T09:58:18Z")

</div>

> [@knolleary](#):
>
> little bit of friction

Ah! But then adding the second node and deleting it with a maintain-connection (i.e. how to create the self loop now) is also friction, so leaving it as is would allow @Colin and I to create our self reference loops and everyone else to wonder how we created them! 😉

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 February 2025 10:45 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/7 "2025-02-06T10:45:13Z")

</div>

> [@knolleary](#):
>
> Requiring a second node, or junction, adds a little bit of friction and makes it a more intentional choice.

Having to add a second node and then to delete it using ctrl delete, adds a bit of friction to. I use the feature/bug as you call it in some flows. To fix this would cause breaking changes. I for one vote to keep this feature.

---

<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:** [6 February 2025 10:55 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/8 "2025-02-06T10:55:15Z")

</div>

> [@E1cid](#):
>
> I use the feature/bug as you call it in some flows

I don't because I never thought about it - I also thought/assumed that self-connecting nodes wasn't a use-case for the day-2-day. But having discovered it, I would also definitely use it in the future. So I would also vote for not touching a running system.

---

<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:** [6 February 2025 11:04 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/9 "2025-02-06T11:04:55Z")

</div>

> [@E1cid](#):
>
> To fix this would cause breaking changes. I for one vote to keep this feature.

Any fix would be to stop the Cmd/Ctrl-Delete action from leaving a node wired to itself. Any nodes already wired to themselves would be untouched - nothing would break other than the ability to create new such cases.

It isn't really a burning issue... I've raised it, may just let it be as it is for now.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 February 2025 11:13 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/10 "2025-02-06T11:13:53Z")

</div>

IF you did remove it, I suppose i could just manually change the wire array element to self loop any way. So in any case I could still self loop if I wish.

---

<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:** [7 April 2025 11:14 UTC](https://discourse.nodered.org/t/selfconnectedness-or-how-to-connect-a-node-to-itself/95174/11 "2025-04-07T11:14:22Z")

</div>

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