I had a Photon acting up on me the other day where it wouldn’t accept a new sketch and here is what fixed it for me.
Using the latest version of the Particle CLI run this command:
Particle Doctor
Then follow the steps, you will need to put the device into blinking yellow DFU mode a couple times.
For me, the OpenSSL tool will not run at the end but it still fixed my Photon.