I encountered this yesterday, I expected a syntax error but this message was shown.
My mistake: I wrote "SELECT m.id, m.MAX(id_number) as id_number..." instead of "SELECT m.id, MAX(m.id_number) as id_number...".... the error is with the MAX. The error message wasn't too helpful.