When Special:EntityData is called with a revision parameter that belongs to a different page than the page of the requested entity, then an HTTP 404 error is returned; however, if the other page is not an entity page, then an HTTP 500 error is returned instead – according to the debug log, EntityDataRequestHandler attempts to deserialize the content as JSON and doesn’t catch the resulting MWContentSerializationException.
Example on Wikidata: https://www.wikidata.org/wiki/Special:EntityData/Q42.json?revision=618133175