Nodered not starting

Recently, nodered has been failing to start in my HA. I am unsure of when this became an issue so cannot trace it back to a specific update.

I have had a few flows which were flows imported from forums for use in later Flow projects so I know that some of thesesl would not be correctly set up for my system (other people’s device names etc).

However, I managed to disable those identified in Safe Mode so thought it would now be OK. However after the most recent HA upgrade and hence a restart, still failing to start. Logs are below:

14 Jul 01:58:45 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:58:45 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:58:50 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:58:50 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:58:55 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:58:55 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:00 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:00 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:05 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:05 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:10 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:10 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:15 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:15 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:20 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:20 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:25 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:25 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:30 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:30 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:35 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:35 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:43 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:43 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:48 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:48 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:53 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:53 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 01:59:58 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 01:59:58 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:03 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:03 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:08 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:08 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:13 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:13 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:18 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:18 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:23 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:23 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:28 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:28 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:33 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:33 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:38 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:38 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:43 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:43 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:48 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:48 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:53 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:00:54 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:00:58 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:00 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:04 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:07 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:09 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:12 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:14 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:17 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:19 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:22 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:24 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:27 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:29 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:32 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:34 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:37 - [info] [server:Home assistant] Connecting to http://supervisor/core
14 Jul 02:01:39 - [info] [server:Home assistant] Connected to http://supervisor/core
14 Jul 02:01:39 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 02:01:41 - [info] [server:Home Assistant] Connected to http://supervisor/core
14 Jul 02:02:17 - [info] [server:Home assistant] Connection closed to http://supervisor/core
14 Jul 02:02:17 - [info] [server:Home assistant] Connection closed to http://supervisor/core
14 Jul 02:02:17 - [red] Uncaught Exception:
14 Jul 02:02:17 - [error] UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".
[02:02:17] INFO: Service Node-RED exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
[02:02:18] INFO: Service NGINX exited with code 0 (by signal 0)
s6-rc: info: service nginx successfully stopped
s6-rc: info: service init-nginx: stopping
s6-rc: info: service nodered: stopping
s6-rc: info: service init-nginx successfully stopped
s6-rc: info: service nodered successfully stopped
s6-rc: info: service init-nodered: stopping
s6-rc: info: service init-nodered successfully stopped
s6-rc: info: service init-customizations: stopping
s6-rc: info: service init-customizations successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped```

Completely reinstalled including removing the nodered library to ensure no flows cause any issues.

Still did not work. The log is below:

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 14.3.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.3  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.7.2
 Home Assistant Supervisor: 2023.07.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-nginx: starting
s6-rc: info: service init-customizations: starting
s6-rc: info: service init-customizations successfully started
s6-rc: info: service init-nodered: starting
s6-rc: info: service init-nginx successfully started
s6-rc: info: service init-nodered successfully started
s6-rc: info: service nodered: starting
s6-rc: info: service nodered successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[21:43:46] INFO: Starting Node-RED...
> start
> node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js
14 Jul 21:43:52 - [info] 
Welcome to Node-RED
===================
14 Jul 21:43:52 - [info] Node-RED version: v3.0.2
14 Jul 21:43:52 - [info] Node.js  version: v18.16.1
14 Jul 21:43:52 - [info] Linux 6.1.21-v8 arm64 LE
14 Jul 21:43:54 - [info] Loading palette nodes
14 Jul 21:44:02 - [info] Dashboard version 3.5.0 started at /endpoint/ui
14 Jul 21:44:04 - [info] Settings file  : /etc/node-red/config.js
14 Jul 21:44:04 - [info] Context store  : 'default' [module=memory]
14 Jul 21:44:04 - [info] User directory : /config/node-red/
14 Jul 21:44:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Jul 21:44:04 - [info] Flows file     : /config/node-red/flows.json
14 Jul 21:44:04 - [warn] Encrypted credentials not found
14 Jul 21:44:04 - [info] Server now running at http://127.0.0.1:46836/
14 Jul 21:44:04 - [info] Starting flows
14 Jul 21:44:04 - [info] Started flows
[21:44:04] INFO: Starting NGinx...
14 Jul 21:44:09 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:14 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:19 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:24 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:29 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:34 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:40 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:45 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:50 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:44:55 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:45:00 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:45:05 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:45:10 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:45:15 - [info] [server:Home Assistant] Connecting to http://supervisor/core
14 Jul 21:45:23 - [info] [server:Home Assistant] Connected to http://supervisor/core
14 Jul 21:45:44 - [info] [server:Home Assistant] Connection closed to http://supervisor/core
14 Jul 21:45:44 - [info] [server:Home Assistant] Connection closed to http://supervisor/core
14 Jul 21:45:44 - [red] Uncaught Exception:
14 Jul 21:45:44 - [error] UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".```

Try adding this to the top of your settings.js file to get a better description of the error.

process.on('unhandledRejection', (reason, p) => {
  console.log('Unhandled Rejection: ', p, 'reason:', reason);
});

Do you have any errors in your HA logs about why NR is disconnecting from HA? Might need to turn logging on for the websocket component.

Hi. Tried the advice above but, possibly because of my own ignorance, found no info. So, bit the bullet and restored HA to a 3 week old backup. Now being careful with backing up before updates. So far, Nodered still working and I believe I am now more up-to-date than when Nodered started failing.