So I had this problem on Windows but a Mac answer pointed me in the right direction.
The previous day I had been playing Spotify on one device and controlling it from another device.
I shut down the Windows version. Opened the version on my phone.
Played a bit of a song (while online).
Opened it in Windows and checked that the "connect to a device" was the Windows version and then played some music and the problem had gone away.
Didn't need to reset cache, restart computer, turn off hardware acceleration or any other things here.
Might not even have needed to shut Spotify down. Maybe just playing on a different device, or maybe even just checking "connect to a device" is pointing at the correct device might have been sufficient.
Spotify, why is this question marked solved? Turning off hardware acceleration is not a solution it's just a work around. I think you someone needs to look into why this is occuring and add a change to prevent it from ever happening.
There are 5 different answers marked as solutions. Have you tried them all? For me, it was the device that Spotify was trying to play to was offline. The solution was to play on a different device (for me, phone) and then move back to the desktop version and try again.
You're right about it occuring when you go offline. The issue is that when you go back online Spotify does not detect that the network is back. So the only way to play the song again is to close the application and reopen it. That is not a solution it's a work around. The problem is a bug. The solution is to fix the bug.
This problem is still not solved. Using windows 10, I have tried logging in, logging out, turning off hardware acceleration, restarting spotify and nothing works. If I reboot my machine (which I would need to do mulitple times per day and is very disruptive) I can get it to work again, but clearly there is a bug or issue which needs to be addressed. Spotify, we are premium members paying for a service and I do not see you responding or dealing with this issue. You have already double billed my account twice and only refunded one of those double billings (separate issue), but my point being your service is not great lately and there are other options. Fix this or people will leave.