Handle failure to deserialize entity in lua

Change-Id: I85e387b62ff0f940de31acec166c28ff389114ad