If you only want to retunr error, maybe you can just do callback(error); The second argument should then be undefined.