The poet used to warn of the vanity of mental ambition."

One meaning of vanity that would seem to make sense in this context is "futility, pointlessness."