Skip first entry on middleware duplicate entry exception

Update api error parsing to latest Doctrine version.