Lost connection to server, reconnecting in

I somehow screwed up my node-red again and have this reacuring message

'Lost connection to server, reconnecting in 1s. [Try now]'

How do I find out what is causing it ?

2020-04-11 19_12_48-Node-RED _ 192.168.2.40

1 Like

Have a look at your node-RED log to see if an error is reported.
Also, what did you do immediately before getting the problem?

I tried to load a Blynk node and gave up as I couldn't get it to work. Then I discovered everything had gone ! all flows gone, so I reloaded a backup I had of the files from /home/pi/.node-red to discover this problem .

Have you looked at your log?

Sorry where do I find the log ?

You haven't told us anything about your hardware or operating system, but on a pi it's usually node-red-log

Sorry Raspberry pi 2 and Raspbian.

type or p11 Apr 19:07:10 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as C9013240004
11 Apr 19:07:21 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:07:21 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:07:23 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:07:23 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:08:58 - [info] Stopping modified flows
11 Apr 19:08:58 - [info] Stopped modified flows
11 Apr 19:08:58 - [info] Starting modified flows
11 Apr 19:08:58 - [info] Started modified flows
11 Apr 19:14:23 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:23 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:24 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:24 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:24 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:24 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:25 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:14:25 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:17:08 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as B737940002
11 Apr 19:27:08 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as C764B200003
11 Apr 19:37:08 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as B2BDE20002
11 Apr 19:45:00 - [error] [ui_text:9933c639.a3a268] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:45:00 - [error] [ui_text:1c929460.9f2bec] SyntaxError: Unexpected token u in JSON at position 0
11 Apr 19:47:10 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as 96BB01C0005
Started Node-RED graphical event wiring tool.
11 Apr 19:57:08 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as 9FA2FC0004aste code here

I accidentally did a node-red-start first (up arrow)

It might be better to capture the log from when node-RED starts, so we can see the full log

First stop node-RED
node-red-stop

Then start node-RED
node-red-start

node-RED will then start printing the log.

If you can copy everything after the line
Starting as a systemd service.

(you can stop the logging using Ctrl + C)

Thanks Paul,

type or paste cStarted Node-RED graphical event wiring tool.
11 Apr 20:33:16 - [info]
Welcome to Node-RED
===================
11 Apr 20:33:16 - [info] Node-RED version: v1.0.5
11 Apr 20:33:16 - [info] Node.js  version: v10.16.0
11 Apr 20:33:16 - [info] Linux 4.9.35-v7+ arm LE
11 Apr 20:33:18 - [info] Loading palette nodes
11 Apr 20:33:23 - [info] Dashboard up and running
11 Apr 20:33:28 - [info] Worldmap version 2.0.18
11 Apr 20:33:28 - [info] Dashboard version 2.15.5 started at /ui
11 Apr 20:33:30 - [warn] ------------------------------------------------------
11 Apr 20:33:30 - [warn] [node-red-contrib-ibm-watson-iot/wiotp] Error: Cannot find module 'format'
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Client] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Response] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Read] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Getter] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Flex-Getter] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Write] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Flex-Write] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Server] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Flex-Server] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Queue-Info] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Flex-Connector] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-IO-Config] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-modbus/Modbus-Response-Filter] Error: Cannot find module 'source-map-support' (line:1)
11 Apr 20:33:30 - [warn] [node-red-contrib-telegrambot/telegrambot] Error: Cannot find module 'array.prototype.findindex'
11 Apr 20:33:30 - [warn] ------------------------------------------------------
11 Apr 20:33:30 - [info] Settings file  : /home/pi/.node-red/settings.js
11 Apr 20:33:30 - [info] Context store  : 'default' [module=memory]
11 Apr 20:33:30 - [info] User directory : /home/pi/.node-red
11 Apr 20:33:30 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Apr 20:33:30 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
11 Apr 20:33:31 - [info] Server now running at http://127.0.0.1:1880/
11 Apr 20:33:31 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
11 Apr 20:33:31 - [info] Starting flows
11 Apr 20:33:32 - [info] [worldmap:map] started at /worldmap
11 Apr 20:33:34 - [info] Started flows
11 Apr 20:33:34 - [info] [mqtt-broker:bf503048.2a203] Connected to broker: mqtt://192.168.2.40:1883
11 Apr 20:33:34 - [info] [mqtt-broker:.60] Connected to broker: mqtt://192.168.2.60:1883
11 Apr 20:33:34 - [error] [json:a9a42e8d.a71b4] Unexpected token O in JSON at position 0
11 Apr 20:33:34 - [error] [json:a9a42e8d.a71b4] Unexpected token O in JSON at position 0
11 Apr 20:33:34 - [info] [mqtt-broker:CloudMQTT] Connected to broker: mqtts://m23.cloudmqtt.com:26499
11 Apr 20:33:36 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as 2B8E61BF203
11 Apr 20:34:36 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as 62D75C0005
ode here

You have some grumbles from node-RED about node-red-contrib-modbus & node-red-contrib-telegrambot, but there is an error showing about json format from a node that you are using.

I would stop node-RED
node-red-stop & restart it in 'safe' mode node-red-start -safe

That should enable you to search for the node which is presenting the problem, and resolve it.

Once started, go to the hamburger top right, and search flow for a9a42e8d.a71b4 which should identify the node.

Once you've cleared the problem, stop and start node-RED using node-red-start

I tried removing both the nodes but generated an error , I'll try the way you mentioned

I wouldn't have removed them, as the main error is the JSON issue. The node problems are just warnings.
When you start up in safe mode, I would re-add those nodes again.

Neither of those nodes were used just remnants from me reloading old json files I copied, hence I deleted them. I still getting the reconnect error though :thinking:

Show us what the startup log looks like now.

Did you do this?
It seems to me that you have some wrongly formatted json at, or just before that node.

Paul I deleted that flow and here's the start log

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
12 Apr 10:58:24 - [info]
Welcome to Node-RED
===================
12 Apr 10:58:24 - [info] Node-RED version: v1.0.5
12 Apr 10:58:24 - [info] Node.js  version: v10.16.0
12 Apr 10:58:24 - [info] Linux 4.9.35-v7+ arm LE
12 Apr 10:58:26 - [info] Loading palette nodes
12 Apr 10:58:31 - [info] Dashboard up and running
12 Apr 10:58:36 - [info] Worldmap version 2.0.18
12 Apr 10:58:36 - [info] Dashboard version 2.15.5 started at /ui
12 Apr 10:58:38 - [warn] ------------------------------------------------------
12 Apr 10:58:38 - [warn] [node-red-contrib-telegrambot/telegrambot] Error: Cannot find module 'array.prototype.findindex'
12 Apr 10:58:38 - [warn] [node-red-contrib-ibm-watson-iot/wiotp] Error: Cannot find module 'format'
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Client] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Response] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Read] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Getter] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Flex-Getter] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Write] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Flex-Write] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Server] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Flex-Server] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Queue-Info] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Flex-Connector] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-IO-Config] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] [node-red-contrib-modbus/Modbus-Response-Filter] Error: Cannot find module 'source-map-support' (line:1)
12 Apr 10:58:38 - [warn] ------------------------------------------------------
12 Apr 10:58:38 - [info] Settings file  : /home/pi/.node-red/settings.js
12 Apr 10:58:38 - [info] Context store  : 'default' [module=memory]
12 Apr 10:58:38 - [info] User directory : /home/pi/.node-red
12 Apr 10:58:38 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Apr 10:58:38 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
12 Apr 10:58:39 - [info] Server now running at http://127.0.0.1:1880/
12 Apr 10:58:39 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
12 Apr 10:58:39 - [info] Starting flows
12 Apr 10:58:40 - [info] [worldmap:map] started at /worldmap
12 Apr 10:58:42 - [info] Started flows
12 Apr 10:58:42 - [info] [mqtt-broker:bf503048.2a203] Connected to broker: mqtt://192.168.2.40:1883
12 Apr 10:58:42 - [info] [mqtt-broker:.60] Connected to broker: mqtt://192.168.2.60:1883
12 Apr 10:58:42 - [error] [emoncms:Emoncms Push] [object Object]
12 Apr 10:58:42 - [info] [mqtt-broker:CloudMQTT] Connected to broker: mqtts://m23.cloudmqtt.com:26499
12 Apr 10:58:44 - [info] [e-mail:myemail@hotmail.com] Message sent: 250 2.0.0 Ok: queued as 6FB9D1C0002


I've no idea where the warnings are coming from, I don't use Telegram, watson or Modbus anymore - I was just experimenting ages ago and subsequently deleted them I thought

From the hamburger menu select Configuration Nodes and I suspect you will find some unused ones there. Delete them. You should have got a warning about them in the little popup on each deploy.

What I did notice from the hamburger is On all flows shows and the other shows none ?

Do you still get the error with those nodes installed?

I reloaded the .json files from the backup of them back into the .node-red folder and restart nodered and I get the same lost connection message.

One thing did cross my mind is the error coming from the webpage it self or a server ?
The modbus node says this

And telegram

Also I did notice there isn't any debug info in the debug tab window ?