glDrawArrays is failing with GL_INVALID_ENUM
I used MESA_DEBUG=1 (Debugging Tips | mesa3d.org, Environment Variables | mesa3d.org) and found out that glEnable(TEXTURE_2D) was causing the error.

I don't know why it only got triggered on the glDrawArrays (maybe weird bindings) but when I removed that call it no longer failed with GL_INVALID_ENUM.