So while developing a solution for a customer I had hard-coded the etc codes for each entity not realising that once deployed on the new system the entity/object type codes for each entity may change on the destination system.

Real life saver!