We had trouble exporting data from an ArcGIS service layer to GeoJSON format. Other formats (JSON, etc.) worked fine. The response was a generic 400 error ("Failed to execute query"). It was puzzling because other services on the same server returned GeoJSON just fine.
After a lot of looking at it, we discovered that the difference was that the layer's "HasM" attribute was true. We removed the M values from the data, and now the GeoJSON works. Sounds like a bug to me.
Since the layer now works I can't share the error, but here's a query on a layer where I found another user had posted a question with a related problem which has M values and shows the behavior: