catch error on missing ctx