The flow of this function is odd.  You should always "return early," which in this case means calling the callback in the error case(s) as soon as you have them (e.g., line 49).  Then you don't have to do so many odd checks like you're doing on 54.