The 502s are independent of company number. For example, I got 502 when I hit https://api.companieshouse.gov.uk/company/05596416/charges last night, but now I get 404 — which is what I would expect because there are no charges for that company. I've restarted my scripts numerous times after getting 502s only to have them error on different company numbers than they did previously.
I'm reluctant to restart my scripts without some assurance that this issue has been resolved. Keeping track of all the discontinuities in the data retrieval is proving extremely time-consuming.