FIXED: 502 Bad Gateway nginx

I’ve been unable to start Node Red for several weeks (possibly after an update). I keep getting the following error:

21 Jan 17:20:52 - [red] Uncaught Exception:
21 Jan 17:20:52 - [error] Error: Huejay: connect EHOSTUNREACH
    at /config/node-red/node_modules/huejay/lib/Transport.js:106:15
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[17:20:52] INFO: Starting Node-RED...

I’ve got no idea what this means, or how to fix it. I’d be grateful for a bit of hand holding, please!


If you installed an update the system cues you to create a backup. You should be able to find it in your backups. If there is then restore it.

Thanks for the reply ‘Mikefila’

Backing up prior to an update doesn’t work on my system - it just stalls with the busy icon, and I’ve been a bit lax in doing it manually.

I’m considering reinstalling Node Red. Will removal also remove all my flows?


Your flows are store in the config folder in a node-red folder. This doesn’t get removed when you uninstall the addon. However just in case there is a problem with the actual nodejs modules, you should delete the node_modules folder from inside the node-red folder before re-installing the addon.

1 Like

Thanks Andrew.

Useful info. I’ll use it to download the Node Red config folder, before I try anything that might cause me to lose the flows.


I carried out the following:

  1. Copied the node-red directory to my PC for safe keeping.
  2. Uninstalled the Node Red add-on.
  3. Deleted the entire node-red directory (I needed to do this as a new installation leaving the residual files gave the same original error.)
  4. Removed the empty flows.json file in the fresh installation.
  5. Copied my original flows.json file to the node-red directory in the fresh installation.

It worked, but I’m having to laboriously add the missing pallet items and reconfigure some of them.

Thanks for the help - I was pissed off and getting ready to ditch Node Red!


I wouldn’t blame node-red at all. Works like a charm since years on another pi.
The HA integration seems to be as stunning as ESPhome, tasmota and others. They all did work until late last summer and since then I can’t name a single HA update which didn’t bring new issues.
Sorry to say but my conclusion is that the 2 terms ‘smart’ and ‘solution’ won’t stick to HA any longer.

1 Like