Eliminate duplicate entity id warnings.
Eliminate duplicate entity id warnings.

Also, fix bad error logging (was dereferencing unallocated memory).
PiperOrigin-RevId: 147662634
Change-Id: Idc0cafa21237244be384715b0926fd419682da36

google/corgi,google/corgi