Throw the correct exception when a duplicate field is added.