I have traced back to a few different causes to this error
Undeclared success counter used when success and threw exception. So even if the write was success the catch would trigger and print an unrelated error.
Sometimes the song was found and the Json downloaded and parsed but wouldn't contain lyrics so it fails while trying to write None to disk. Added a check for this case.
Other locale characters such as Japanese or Arabic would throw exceptions when writing to disk due to being inexistent on the OS's charset. Fixed by ensuring all text written is encoded in UTF-8.
I have traced back to a few different causes to this error