Site not loading, "Unexpected token < in JSON at position 0" Error

Issue Summary

I just installed Local and made one WordPress site. Suddenly, upon launch instead of the “Local sites” list, I only see this error message :

Error, could not load sites.

Unexpected token < in JSON at position 0

Troubleshooting Questions

  • I had only one WordPress site configured in Local.

  • I am still able to create a new, plain WordPress site in Local and access it in a Browser. But the place where the sites are listed still shows the error message, also after a restart. So I’m unable to select and start the website.

Replication

I don’t know how to replicate the issue.

Screenshot:

System Details

  • Version of Local: 5.9.4+5115

  • Operating System: macOS 10.14.6 (Mojave)

  • Local Log is attached.

local-lightning.log (52.6 KB)

Update: I have been able to fix the issue.

What I did:

I decided to search for the JSON file containing the list of sites. I went into ~/Library/Application Support/Local, where I found a file named sites.json.

I changed the name of that file and relaunched Local.

As expected, Local now told me that there is no site, and prompted me to create one. Upon creation of a new site, a new sites.json file gets created.

I looked at the content of the file that was causing trouble, but couldn’t spot any formatting error.

I switched the JSON files to see what happens. Bingo, Local is launching normally and showing me the sites as usual. The mysterious issue is gone…