Broken debug and inject nodes in Node-RED

Broken inject and debug nodes in Node-RED seem to be a never-ending story. They break occasionally, and no one seems to have truly identified the root cause of this very annoying behavior. Now it has happened to me again. Honestly, I have no idea why—what I did, or if I even did anything. It just happened.

I’ve tried every tip and trick I could find on the internet:

  • Toggled Settings > Grid > Show grid (on/off)
  • Restarted the dev server physically
  • Hard-refreshed the browser
  • Cleared the browser cache
  • Tried another browser/computer
  • Re-deployed flows
  • :1880

etc…

Except for one thing… Just load the extension, watch the disabled debug and inject nodes, wait a little (actually, much longer), and then—bang! After 10–15 minutes, they might get enabled automatically! Fantastic! I did absolutely nothing to trigger this.

Current setup:

  • Home Assistant 2025.12
  • Node-RED 20.2.3

To me, this indicates a bug somewhere. The behavior is definitely not new; it happens every now and then. Is it an old never fixed bug? A new one?

What is the problem?

WebSocket issues probably.

The root cause is potentially outside of Node-RED, and possibly due to several reasons, therefore identifying the precise cause of this issue, and fixing it, is always going to be difficult.

It is unlikely to be a bug, as the key software runs very nicely most of the time for the vast majority.

Node-RED runs as a service, and runs the main execution engine that loads, then runs, the flows. Inside Node-RED is a server that provides much of the backbone system via API calls.

The front end bit that we see, the editor, is a completely different program, running as JavaScript inside a browser. The two programs communicate, when required, over a WebSocket between the JS editor and the Node-RED server.

This link is used to uplift the nodes, flows, and other settings when the editor first starts, and this can be the first sign of problems if the editor startup fails to complete. Problems with the JavaScript environment can be a cause at this point, and that is all down to the browser.

Once the editor is up and running, the key time the WebSocket gets used is to push back edit changes using the ‘deploy’ button. This causes NR to stop running the changed flow, dispose of all in-flight messages, and then upload the new edited copy, then restart the flow.

The inject nodes, the debug nodes, and the node status message are also all connected via the WebSocket. Inject nodes send triggers back to the NR flow execution to start a new message, debug nodes receive output from the NR flow for display in the debug window, and the individual node status messages are updated as required.

The primary reason why all of this stops is due to a failure in the connection between the editor and the NR server. There are other reasons, mostly to do with the editor running in the browser JS environment.

WebSockets are wonderful things, but they can easily get overloaded. The Home Assistant WebSocket nodes all connect back to Home Assistant via another WebSocket, and it is well noted that there should be only one HA Server Configuration node. If, typically by importing lots of flows from other sources, there are multiple HA Server config nodes, then each sets up a similar WebSocket connection, and all pointing to the same HA connection. Overload happens. This can also happen by setting up, for example, an Event: all node without specifying a filter. In this case, the WebSocket between NR and HA pulls in everything from the HA Event Bus, which can be very busy indeed, and the WebSocket connection gets overloaded.

When the HA-NR WebSocket connection gets overloaded, so does everything else, since NR is now too busy dealing with that. At this point, the debug and inject nodes appear to stop working, because there is no active or only a very slow connection between the editor and Node-RED server.

Have you checked to see what other ‘servers’ (configuration nodes) you have running in Node-RED? Do you have too many HA servers, are they doing too much, is Node-RED itself doing too much? Remember, NR is a single thread execution, and if any one node holds the processor for any period of time, NR itself will freeze while the individual node is running.

I have had not issue with Node Red nodes at all and I run many flows and have for years.

This sounds a bit like a memory issue.
Do you make sure you have no loops that continuously carry over data from previous iterations?

Thanks for you answer! Actually I only have one Home Assistant configuration node (used by 136 other nodes) and one HA MQTT configuration node (used by 44 other nodes). I know what you wrote but is it likely that my problem is within this space? (And if it is of any value, the node red add on consumes about 1.5% CPU usage, 3.5% RAM, RPi 5 16GB)

Thanks Wally. I dont think I challenge the system too hard: the node red add on consumes about 1.5% CPU usage, 3.5% RAM, RPi 5 16GB

You can see it like that.
What amount of ram you have free for data is not the same as what amount of data you can work with at the same time.

The problem with debug / inject / status messages failing is indeed a never ending story, and there is no simple magic sliver bullet that can fix it.

The issue could be in the browser [reload, change to another], it could be with Node-RED [check for loops, memory issues etc - certainly running out of memory triggers major garbage collection routines that stop all other processing], however the most prominent cause is a failure of the WebSocket connection. Finding out what has caused that is the real challenge.

You can find further discussions on this by searching in the node-red forum. The few ‘solutions’ that appear there I think relate to addressing things like proxy issues that have blocked the websocket connection between NR and the editor. I would venture to suggest [it is my opinion] that there are more issues reported here in the HA forum rather than the main Node-RED forum. My assumption is therefore that, for many HA users unlike mainstream NR users, Node-RED is run supervised and in docker containers, and there are resulting issues with the connections between containers.

As you say in your OP, these nodes “break” occasionally, and where an issue is not repeatable on demand, there is almost no opportunity to find the cause. I have no idea how to debug a WebSocket connection, but perhaps someone else can proffer a way to monitor the Node-RED → Editor [browser] connection.

At the very least, I hope that I added a few appropriate suggestions to the growing list of things to try :grin:

1 Like

Maybe the reason why I never have had those issues are that my browser is set up to never cache anything locally accessed.

Hmm… That was interesting @WallyR! I did not not know that such “filtering” was possible? I guess that I need some googling here…
Thanks!

I use Firefox and it is possible there if you dive into the advanced settings.

1 Like