So what we should do isif (!sbt || !sbt.Endpoints) then throw an error but don't try to recover. Trying to recover by creating these objects just masks the problem, it's better to fail gracefully and then we can try find the root cause.