# Delay node not working - Lost connection to server

**URL:** <https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083>\
**Category:** General\
**Created:** [22 May 2021 08:48 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083 "2021-05-22T08:48:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwyrp](https://avatars.discourse-cdn.com/v4/letter/q/278dde/32.png) [@qwyrp](https://discourse.nodered.org/u/qwyrp)\
**Post date:** [22 May 2021 08:48 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/1 "2021-05-22T08:48:06Z")

</div>

A while ago I updated my system and all seems well but I recently discovered the following error:  
My delay node isn't functioning anymore. It's getting started but then no respons and I notice the following error: **Lost connection to server**

Hereby some log info and I noticed some errors and warning:

22 May 10:40:20 - [info]

# Welcome to Node-RED

22 May 10:40:20 - [info] Node-RED version: v1.3.4  
22 May 10:40:20 - [info] Node.js version: v12.22.1  
22 May 10:40:20 - [info] Linux 5.10.17-v7+ arm LE  
22 May 10:40:22 - [info] Loading palette nodes  
22 May 10:40:33 - [info] Settings file : /home/pi/.node-red/settings.js  
22 May 10:40:33 - [info] Context store : 'default' [module=memory]  
22 May 10:40:33 - [info] User directory : /home/pi/.node-red  
22 May 10:40:33 - [warn] Projects disabled : editorTheme.projects.enabled=false  
22 May 10:40:33 - [info] Flows file : /home/pi/.node-red/flows\_rpi-3b-plus.json  
22 May 10:40:33 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
22 May 10:40:33 - [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.

22 May 10:40:33 - [info] Starting flows  
22 May 10:40:34 - [info] Started flows  
22 May 10:40:34 - [info] [mqtt-broker:Domotics Master] Connected to broker: mqtt://192.168.1.232:1883  
22 May 10:40:34 - [info] [mqtt-broker:89bfc099.8b73e] Connected to broker: mqtt://192.168.1.232:1883  
22 May 10:40:35 - [error] [json:e418fc5c.ebf6a] Unexpected token O in JSON at position 0  
22 May 10:40:35 - [error] [json:46673cd2.da5ba4] Unexpected token O in JSON at position 0  
22 May 10:40:35 - [info] nora: connected, uid: ExGw6LLolKYPJfqw1EYQfIKmKLE2  
22 May 10:40:41 - [info] nora: synced 6 device(s), group:

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 May 2021 09:03 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/2 "2021-05-22T09:03:22Z")

</div>

> [@qwyrp](#):
>
> 22 May 10:40:35 - [error] [json:e418fc5c.ebf6a] Unexpected token O in JSON at position 0  
> 22 May 10:40:35 - [error] [json:46673cd2.da5ba4] Unexpected token O in JSON at position 0

I would investigate those errors first. You should also see those in the debug pane and clicking on the node id there should take you to the node. Then attach a debug node showing what is going into the json node should show you what the problem is. Do that for the two json nodes.

It isn't the Delay node that is not working, it is whatever is feeding the bad data to the json nodes.

Edit, if the messages don't appear in the debug pane then use the Search feature (CTRL+F) to search for the node ids (eg e418fc5c.ebf6a).

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [22 May 2021 09:23 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/3 "2021-05-22T09:23:01Z")

</div>

This could be a retained mqtt msg that is being sent when NR first connects to the broker. I suspect the mqtt node is trying to convert the msg Towson but it is not in that format.

If you use something like mqtt explores, you could take a look and see if there are any retained messages.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [22 May 2021 09:23 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/4 "2021-05-22T09:23:31Z")

</div>

Seems like LWT message with not well formatted payload. Contains string "Online" or "Offline" . Even it is valid JSON string, it is not valid JSON object. So the parsing fails.  
Easiest will be to catch that error  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e9d892bca519338b48b9648a94dfabecd5e110db.png)  
And then with split node still get correct payload from the LWT message

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/421aba72f309b8036cfc9b72a433eb1a3db885d3.png)

If it is not LWT, you still can figure out what it is and do what ever is needed with that kind of messages

---

<div class="post-metadata">

**Author:** ![qwyrp](https://avatars.discourse-cdn.com/v4/letter/q/278dde/32.png) [@qwyrp](https://discourse.nodered.org/u/qwyrp)\
**Post date:** [22 May 2021 13:25 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/5 "2021-05-22T13:25:34Z")

</div>

@hotNipi : I believe you're right and it's a LWT problem. I'm gonna try to fix it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 July 2021 13:26 UTC](https://discourse.nodered.org/t/delay-node-not-working-lost-connection-to-server/46083/6 "2021-07-21T13:26:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
