is "set user_id [ad_maybe_redirect_for_registration]" within a catch?
ad_maybe_redirect_for_registration issues a double return that could cause
problems in that case. It happens after a redirect so your users should not
see a problem because of this.