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

ERROR: Unexpected token N in JSON at position xxx in MainThread frontend js - Uncaught SyntaxError #12628

Closed
genestealer opened this issue Feb 23, 2018 · 5 comments

Comments

@genestealer
Copy link

genestealer commented Feb 23, 2018

Home Assistant release (hass --version):
0.63.3 (Python virtual environment, running with root)

Python release (python3 --version):
Python 3.5.2

Component/platform:
MainThread

Description of problem:
Home Assistant will not allow you to login, if already logged in, it simply disconnects.
Error messages:

2018-02-23 18:23:55 ERROR (MainThread) [frontend.js.latest.201802090] https://REMOVED/states:1:
119 Uncaught SyntaxError: Unexpected token N in JSON at position 118
2018-02-23 18:23:55 ERROR (MainThread) [frontend.js.latest.201802090] https://REMOVED/states:1:
119 Uncaught SyntaxError: Unexpected token N in JSON at position 118
2018-02-23 18:23:55 ERROR (MainThread) [frontend.js.latest.201802090] https://REMOVED/states:1:
119 Uncaught SyntaxError: Unexpected token N in JSON at position 118

Also failed when trying setting frontend to use javascript_version: es5

2018-02-24 18:57:38 ERROR (MainThread) [frontend.js.es5.201802090] https://REMOVED/states:1:14161 Uncaught SyntaxError: Unexpected token N in JSON at position 14160
2018-02-24 18:57:40 ERROR (MainThread) [frontend.js.es5.201802090] https://REMOVED/config/core:1:14161 Uncaught SyntaxError: Unexpected token N in JSON at position 14160

Removing all my sensors helps for a time, but only delays the crash.
Adding them back, one at a time (restarting home assistance each time) to find the issue does not help, as I can add them all back, log into hass only for it to then randomly error on its a few moments later and if you refresh it shows the login screen and becomes stuck on "Loading Data".

Even creating a new Linux server with new Python virtual environment has not effect and issue is repeatable.

I tired, removing the user password, removing SSL, changing the port back to 8123, all on IE, chrome, chrome incognito, separate computers, Android, but to no effect.

Also tried disabling MQTT in case the JASON error was coming from there.

My Home Assistant Configuration: https://github.com/Genestealer/Home-Assistant-Configuration

@genestealer genestealer changed the title frontend.js.latest - Uncaught SyntaxError: Unexpected token N in JSON at position xxx MainThread frontend.js.latest - Uncaught SyntaxError: Unexpected token N in JSON at position xxx Feb 23, 2018
@genestealer
Copy link
Author

Update: I found that when logged into the GUI it will say "Service system_log/write called." in the bottom left corner at the same time the Uncaught JSON error occurs.

@genestealer genestealer changed the title MainThread frontend.js.latest - Uncaught SyntaxError: Unexpected token N in JSON at position xxx ERROR MainThread frontend js - Uncaught SyntaxError: Unexpected token N in JSON at position xxx Feb 24, 2018
@genestealer genestealer changed the title ERROR MainThread frontend js - Uncaught SyntaxError: Unexpected token N in JSON at position xxx ERROR: Unexpected token N in JSON at position xxx in MainThread frontend js - Uncaught SyntaxError Feb 24, 2018
@genestealer
Copy link
Author

genestealer commented Feb 24, 2018

The issue is 99% something to do with my sensors. (I think).
I found that once the "Service system_log/write called." pops up, it locks you out of HASS, which even rebooting the OS will not solve. Removing the sensor .yaml files fixes the issues (post HASS restart), but I cannot see any issues with the files.

My sensor files are 20 separate .yaml files joined using the Merge List:
sensor: !include_dir_merge_list includes/sensors

My sensors: https://github.com/Genestealer/Home-Assistant-Configuration/tree/master/includes/sensors

@genestealer
Copy link
Author

Ah ha! May be due to my older version of "home-assistant-frontend", as per my errors above I have 201802090 and the older Python 3.4.2.

I see frontend/init.py states requirment home-assistant-frontend==20180221.1

Looks like: I need to update my virtualenv Python Python 3.5.2 to Python 3.6. Instructions and more.

@genestealer
Copy link
Author

Moved to a Docker Installation on Ubuntu 17.04, still same issue.

2018-02-25 01:38:56 ERROR (MainThread) [frontend.js.latest.201802090] http://192.168.1.108:8123/hassio:1:239 Uncaught SyntaxError: Unexpected token N in JSON at position 238
2018-02-25 01:38:56 ERROR (MainThread) [frontend.js.latest.201802090] http://hassio:8123/:1:239 Uncaught SyntaxError: Unexpected token N in JSON at position 238

@genestealer
Copy link
Author

Closing, going back to my original build of hass in a VM.
Issue seems to have disappeared after removing Statistics Sensor!


- platform: statistics
  name: "BS Temperature Statistics"
  entity_id: sensor.bs_temperature

@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant