How to find the error source for this error: "Unexpected token } in JSON at position 65"

868 views
Skip to first unread message

cflurin

unread,
Feb 5, 2018, 8:47:49 AM2/5/18
to Node-RED

Hi, I've got this error:


4 Feb 23:33:22 - [error] [json:b264dcc6.df51c] Unexpected token } in JSON at position 65


In the debug tab I can't click on the node as usual.


My HW/SW: pi 3, Raspbian stretch 4.9.59-v7+, node.js v8.9.4, node-red v0.18.1


Is there a way to find the error source?

Nick O'Leary

unread,
Feb 5, 2018, 8:52:15 AM2/5/18
to Node-RED Mailing List
Hi,

the error is telling you that msg.payload is a string, but is not valid JSON. If you pass the message to the Debug node it will show you the string value for you to examine. My guess is a rogue trailing comma before the closing } at position 65 in the string.



Nick




--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/d717a26b-2655-41d0-9133-eb95f010d631%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dean Cording

unread,
Feb 5, 2018, 8:53:10 AM2/5/18
to Node-RED
Use a debug node to examine the msg.payload emitted from the node before the json node.  That will let you examine the json being passed in and check that it is correctly formatted.

cflurin

unread,
Feb 5, 2018, 9:00:02 AM2/5/18
to Node-RED
Thanks for the quick reply.
Ok I have to go through all my JSON nodes, because I have no idea which one doesn't work properly.

Nick O'Leary

unread,
Feb 5, 2018, 9:03:48 AM2/5/18
to Node-RED Mailing List
When you hover over the debug message, the corresponding node is highlighted. Also, if you click the node id in the top right corner of the debug message, it will ensure the corresponding node is visible if its on a different tab.

On 5 February 2018 at 14:00, cflurin <fluri...@gmail.com> wrote:
Thanks for the quick reply.
Ok I have to go through all my JSON nodes, because I have no idea which one doesn't work properly.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

cflurin

unread,
Feb 5, 2018, 9:08:15 AM2/5/18
to Node-RED
That's what I generally do but in this case I can't do it:



On Monday, February 5, 2018 at 3:03:48 PM UTC+1, Nick O'Leary wrote:
When you hover over the debug message, the corresponding node is highlighted. Also, if you click the node id in the top right corner of the debug message, it will ensure the corresponding node is visible if its on a different tab.
On 5 February 2018 at 14:00, cflurin <fluri...@gmail.com> wrote:
Thanks for the quick reply.
Ok I have to go through all my JSON nodes, because I have no idea which one doesn't work properly.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Colin Law

unread,
Feb 5, 2018, 9:15:53 AM2/5/18
to node...@googlegroups.com
You should be hover over where it says b264dcc... and it should highlight that text, then clicking the text should take you to the tab with that node.  Does it highlight?

Colin

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Nick O'Leary

unread,
Feb 5, 2018, 9:17:22 AM2/5/18
to Node-RED Mailing List
What version of NR are you using?

You can also search for the node by its id - b264dcc6.df51c - from the 'Search flows' option in the main menu

Nick

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

cflurin

unread,
Feb 5, 2018, 10:45:07 AM2/5/18
to Node-RED
That's my problem! 
- Search doesn't work  > "No matches found"
- I can't click the node 
- Hover doesn't help

NR Version > my first post:
My HW/SW: pi 3, Raspbian stretch 4.9.59-v7+, node.js v8.9.4, node-red v0.18.1

Nick O'Leary

unread,
Feb 5, 2018, 10:47:00 AM2/5/18
to Node-RED Mailing List
Ok... and what version of node-red are you using?

Do you have subflows? That would be one reason for it not showing up in search.

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

cflurin

unread,
Feb 5, 2018, 10:51:36 AM2/5/18
to Node-RED


On Monday, February 5, 2018 at 4:47:00 PM UTC+1, Nick O'Leary wrote:
Ok... and what version of node-red are you using?

? NR Version 0.18.1 as mentioned in my first post  "My HW/SW: pi 3, Raspbian stretch 4.9.59-v7+, node.js v8.9.4, node-red v0.18.1"

Do you have subflows? That would be one reason for it not showing up in search.

Yes, I'm using subflows
 

Nick O'Leary

unread,
Feb 5, 2018, 10:53:12 AM2/5/18
to Node-RED Mailing List
Ok, so the best clue I can give you is its coming from a JSON inside a subflow. Beyond that, there's nothing more I can do to help.

Nick

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

cflurin

unread,
Feb 5, 2018, 10:59:56 AM2/5/18
to Node-RED
Ok, Thanks for your support, I'll investigate in the subflows.

Dave C-J

unread,
Feb 5, 2018, 11:32:47 AM2/5/18
to node...@googlegroups.com
Hacky way... 
stop Node-RED
manually edit your flow_ file   search for the node id b264dcc6.df51c
within that "node" find the name: field and insert something unique...  "BOO" 
restart Node-RED... reload - then dig around for the Node with BOO  on it... 
add a debug node alongside to report the incoming msg - etc

Nick O'Leary

unread,
Feb 5, 2018, 11:35:45 AM2/5/18
to Node-RED Mailing List
Hacky way... 

No. That won't work. The node reporting the error is inside a Subflow. The ID is generated at runtime as the instance of the subflow is created. That ID will not appear in the flow file.

Nick

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Dave C-J

unread,
Feb 5, 2018, 11:39:44 AM2/5/18
to node...@googlegroups.com
At the risk of diverting... 
If you add a catch node... it will report the msg.... but would it need to be added inside the subflow ? or on the tab where the subflow is ?

cflurin

unread,
Feb 5, 2018, 11:42:43 AM2/5/18
to Node-RED
Right, I got different ID's:

24 Jan 16:39:16 - [error] [json:2fe01090.5365e] Unexpected token } in JSON at position 65

27 Jan 09:19:19 - [error] [json:271c3743.316648] Unexpected token } in JSON at position 65

4 Feb 23:33:22 - [error] [json:b264dcc6.df51c] Unexpected token } in JSON at position 65


On Monday, February 5, 2018 at 5:35:45 PM UTC+1, Nick O'Leary wrote:
Hacky way... 

No. That won't work. The node reporting the error is inside a Subflow. The ID is generated at runtime as the instance of the subflow is created. That ID will not appear in the flow file.

Nick
On 5 February 2018 at 16:32, Dave C-J <dce...@gmail.com> wrote:
Hacky way... 
stop Node-RED
manually edit your flow_ file   search for the node id b264dcc6.df51c
within that "node" find the name: field and insert something unique...  "BOO" 
restart Node-RED... reload - then dig around for the Node with BOO  on it... 
add a debug node alongside to report the incoming msg - etc

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

cflurin

unread,
Feb 5, 2018, 11:45:11 AM2/5/18
to Node-RED
Thanks, I'm still investigating, I'll report the reason as soon I've found it. 

cflurin

unread,
Feb 8, 2018, 4:31:20 AM2/8/18
to Node-RED
Update:
I didn't get this error in the last days.
So I have to wait.

cflurin

unread,
Feb 11, 2018, 6:44:57 AM2/11/18
to Node-RED
That's a mystery, I didn't get any errors for a week. I only added catch nodes plus debug nodes in every flows including the subflows. 
So I think there is no bugs in my sublows.
Any ideas?

cflurin

unread,
Feb 24, 2018, 5:36:18 AM2/24/18
to Node-RED
Finally I fixed this issue.
It was a temperature sensor sending an empty value.
{"name":"dining_temp","characteristic":"CurrentTemperature","value":}
 
The best way for debugging is to put a catch node wired to a debug node in every tab.
A catch node in the subflow doesn't help and should be avoid in order to allow the catch node in the tab to catch the error.

Reply all
Reply to author
Forward
0 new messages