Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Red Fail to start ConfigError #1102

Closed
matthewgutz opened this issue Oct 7, 2023 · 7 comments · Fixed by #1109
Closed

Node Red Fail to start ConfigError #1102

matthewgutz opened this issue Oct 7, 2023 · 7 comments · Fixed by #1109
Labels
bug Something isn't working

Comments

@matthewgutz
Copy link

matthewgutz commented Oct 7, 2023

Describe the bug

Node Red Add on fails to start.

To Reproduce

No response

Expected behavior

Node Red Add on starts

Screenshots

`s6-rc: info: service base-addon-banner: starting

Add-on: Node-RED
Flow-based programming for the Internet of Things

Add-on version: 14.6.1
You are running the latest version of this add-on.
System: Home Assistant OS 10.5 (amd64 / generic-x86-64)
Home Assistant Core: 2023.10.1
Home Assistant Supervisor: 2023.10.0

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
up to date, audited 61 packages in 1s
11 packages are looking for funding
run npm fund for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit for details.
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
[08:05:54] INFO: Starting Node-RED...

start
node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js
7 Oct 08:05:55 - [info]
Welcome to Node-RED
===================
7 Oct 08:05:55 - [info] Node-RED version: v3.1.0
7 Oct 08:05:55 - [info] Node.js version: v18.17.1
7 Oct 08:05:55 - [info] Linux 6.1.45 x64 LE
7 Oct 08:05:55 - [info] Loading palette nodes
7 Oct 08:05:57 - [info] Dashboard version 3.6.0 started at /endpoint/ui
7 Oct 08:05:58 - [info] Settings file : /etc/node-red/config.js
7 Oct 08:05:58 - [info] Context store : 'default' [module=memory]
7 Oct 08:05:58 - [info] User directory : /config/node-red/
7 Oct 08:05:58 - [warn] Projects disabled : editorTheme.projects.enabled=false
7 Oct 08:05:58 - [info] Flows file : /config/node-red/flows.json
7 Oct 08:05:58 - [info] Server now running at http://127.0.0.1:46836/
7 Oct 08:05:58 - [info] Starting flows
[08:05:58] INFO: Starting NGinx...
7 Oct 08:05:58 - [info] Started flows
7 Oct 08:05:58 - [info] [server:Home Assistant] Connecting to http://supervisor/core
7 Oct 08:05:58 - [info] [server:Home Assistant] Connected to http://supervisor/core
7 Oct 08:05:58 - [red] Uncaught Exception:
7 Oct 08:05:58 - [error] ConfigError: Invalid value for 'for':
at EventsStateController._EventsStateController_getTimerValue (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/events-state/EventsStateController.js:157:15)
at EventsStateController.onHaEventsStateChanged (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/events-state/EventsStateController.js:75:23)
[08:05:58] 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
[08:05:58] 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`

Example Flow

No response

This package's version (not the Home Assistant add-on version)

0.57.1

Is Node-RED running in Docker?

Home Assistant add-on

Node-RED version

3.1.0

Node.js version

18.17.1

Additional context

This originally started happening after upgrading to Home Assistant 2023.10.1
Steps I have tried:

I restored a backup from 9/25 which was able to start up.
I uninstalled the Node Red Companion HACS integration and it continued to run correctly.
Updated nodes & everything in the pallet, including "node-red-contrib-home-assistant-websocket" to 0.57.1.
Reboot, Add On worked fine.

I then started adding code to my flows and the Add On crashed with the same original ConfigError.

Tried running "ha supervisor repair" command in the terminal, then rebooted host. Add On still fails to start with the ConfigError.

@zachowj zachowj added the bug Something isn't working label Oct 7, 2023
@zachowj
Copy link
Owner

zachowj commented Oct 7, 2023

You can boot NR in safe mode and then fix the for value. This will allow NR to at least boot.

@matthewgutz
Copy link
Author

I was able to boot into safemode.
What needs to be changed to fix the for value?

@zachowj
Copy link
Owner

zachowj commented Oct 7, 2023

If you change the log level to debug it will show you what node is being instantiated before the error.

@matthewgutz
Copy link
Author

matthewgutz commented Oct 7, 2023

I noticed this line with the debug log. In safe mode I verified I have websocket version 0.57.2 installed.
Is this suggesting its still using the old version for some reason?
image

The debug log lists all my api-call-service, api-current-state, & server-state-changed nodes. Here is a partial image:
image

@matthewgutz
Copy link
Author

matthewgutz commented Oct 7, 2023

Just tried the following:
Uninstalled node red, Deleted node red folder in config, reboot, installed node red, log showed websocket module 0.57.2 was running and did not show the local copy message.
Installed nodes required for my dependencies, restored flows.json. Same ConfigError happened.

I noticed the imported nodes were using a different server configuration node from the default that was created with the fresh NR install.
Deleted all flows & server configuration nodes x2, used https://zachowj.github.io/node-red-contrib-home-assistant-websocket/scrubber/ to remove clear server instances.

Restarted Add On with no flows, worked correctly.
Imported scrubbed flows.json, created a new server configuration, updated all nodes that needed server set.
Deployed & addon crashed with ConfigError for error

@matthewgutz
Copy link
Author

Update:
I had two Event state nodes that I was using flow variables for the "For" values.
image

This worked until Node Red updated. Which was causing the ConfigError message.
By setting these to a constant number node red was able to start up again.

@matthewgutz
Copy link
Author

I tried changing the for values to global variables since maybe the flow variables weren't being defined before evaluating the node. Resulted in the ConfigError For message.

Unchecking Output on Connect seems to have solved the issue.

zachowj added a commit that referenced this issue Oct 9, 2023
Fixes: #1102

fix(poll-state): Handle errors through for initial connection

fix(trigger-state): Handle errors through for initial connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants