When whatever server holding TMI user state information (joins/parts/mods) gets overloaded, the internal requests start timing out. This is why you’re seeing 502/empty string.
As for why you actually get an empty string, I’m fairly positive this is because they are encoding an empty string instead of the intended object, probably due to some internal command they are making returning a string.
For what it’s worth, "" parses fine for JSON so I’m not actually sure why you’re getting an error parsing the JSON.
JSON.parse(‘“”’); → “”
If the error is not in the actual parse, you would want to check that the object key you need exists in the response before using it.