check error code on spawn