Unexpected token '<', "<html> <h"... is not valid JSON prevents ZWaveJS UI from starting



I know what I did, I left a space in a cron specification for ZwaveJS UI backup, but now I can’t start ZwaveJS UI. It was working fine before I restarted the add-on, but now I repeatedly:

Unexpected token '<', "<html> <h"... is not valid JSON

and the log shows:

TypeError: CronPattern: configuration entry second () is empty, check for trailing spaces.
    at CronPattern.partToArray (/opt/node_modules/croner/dist/croner.min.cjs:1:5847)
    at CronPattern.parse (/opt/node_modules/croner/dist/croner.min.cjs:1:5344)
    at new CronPattern (/opt/node_modules/croner/dist/croner.min.cjs:1:4026)
    at new Cron (/opt/node_modules/croner/dist/croner.min.cjs:1:18855)
    at BackupManager.init (/opt/server/lib/BackupManager.js:77:29)
    at startGateway (/opt/server/app.js:313:29)
    at startServer (/opt/server/app.js:218:11)
[22:34:14] INFO: Service Z-Wave JS UI exited with code 1 (by signal 0)

Does ZwaveJS UI have a safe mode? How would I fix this?


If you are certain the issue is a configuration issue you can fix the issue by doing 10 things. I just verified this method works in my own network. Also there maybe an easier way but I came up with the process by using stuff I already had installed on my computer and by using common knowledge I already knew how to do.

  1. Backup up your Z-Wave JS UI addon by going to SETTINGS > SYSTEM > BACKUPS > CREATE BACKUP and download the .tar file to your local pc
  2. Use 7zip to access the contents of the .tar file. Simply right click on the file, hover over 7zip then select open archive from the option list
  3. “Drill Down” until you get to the STORE folder which contains the settings file
  4. Inside of 7Zip Right Click on the settings.json file and select copy to then input an easy to access path. I choose my C drive.
  5. Navigate to where you saved your settings.json file and open it up with notepad
  6. Edit the settings.json file and save it
  7. Drag the edited file from windows explorer into the 7zip window. It will ask you to confirm that you want to copy the file to the archive then overwrite the existing config file
  8. Exit out of 7Zip and click ok twice to update the contents of the archive
  9. Now in Home Assistant go back to SETTINGS > SYSTEM > BACKUPS > Click the 3 dots in the top right hand corner then click upload back then upload your modified backup
  10. The addon should restart and everything should be fixed.

First of all, thanks very much for the help. Unfortunately, I’m stuck on Step 3. The directory structure of the backup is the same as what I see in Home Assistant, and there is no STORE folder that I can see. I’ve tried every directory in the backup. I’m running a standard HASS image.

Did you perform a full backup or partial backup? I only performed a partial backup to backup the Z-Wave JS UI addon.

You rock! I had indeed done a full backup. Thanks so much, and I probably should put in a bug report since I caused this problem completely within the bounds of the UI.