can this throw the error?

Otherwise, it needs to be:

    if (err) {
      next(err);
      return;
    }