How can I check whether CSV/JSON overpass query failed or worked?

How can I distinguish between CSV/JSON overpass query returning no entries and query timeouting and failing?

See overpass turbo for an example of silently failing query.

At least, silently as far as I can see (looked into browser console and see nothing in response that allows me to distinguish “query timed out” and “all buildings were suddenly deleted”)

Obviously, in this case I can know that building are likely still in OSM - but in many cases such assumptions cannot be made.

You need to specify on your query instruction wich area to cover, otherwise you query the complete database. You migth also increase the timeout to more seconds.

Add for example the bbox : nwr[building]({{bbox}});