antiwork/gumroad · error · Link::LinkInvalid

You have to confirm your email address before you can do tha

Error message

You have to confirm your email address before you can do that.

What it means

Raised as Link::LinkInvalid by Link#enforce_user_email_confirmation! when publishing/saving a link whose user is not confirmed. Identical guard shape to the commission and installment email-confirmation guards: product publishing requires a confirmed seller identity because purchases and receipts flow from that address.

Source

Thrown at app/models/link.rb:1664

      elsif default_offer_code.inactive?
        errors.add(:default_offer_code, "cannot be expired")
      elsif !default_offer_code.applicable?(self)
        errors.add(:default_offer_code, "must apply to this product")
      end
    end

    def enforce_not_unpublished_by_admin!
      return unless is_unpublished_by_admin?

      errors.add(:base, "This product was unpublished by Gumroad and cannot be republished by the seller.")
      raise LinkInvalid, "This product was unpublished by Gumroad and cannot be republished by the seller."
    end

    def enforce_user_email_confirmation!
      return if user.confirmed?

      errors.add(:base, "You have to confirm your email address before you can do that.")
      raise LinkInvalid, "You have to confirm your email address before you can do that."
    end

    def enforce_shipping_destinations_presence!
      return unless is_physical
      return if shipping_destinations.alive.present?

      errors.add(:base, "The product needs to be shippable to at least one destination.")
      raise LinkInvalid, "The product needs to be shippable to at least one destination."
    end

    def enforce_merchant_account_exits_for_new_users!
      return if publishable?

      errors.add(:base, publish_blocked_message)
      raise LinkInvalid, publish_blocked_message
    end

    # A seller whose payout setup Stripe rejected has a saved bank account and no rail, so telling

View on GitHub (pinned to afeacbd394)

Solutions

  1. Confirm the account email (resend confirmation from settings) and retry publishing.
  2. Gate the Publish button on user.confirmed?.
  3. Rescue Link::LinkInvalid and render errors.full_messages.

Example fix

# before
link.publish! # LinkInvalid: email not confirmed

# after
unless link.user.confirmed?
  return { error: "You have to confirm your email address before you can do that." }
end
link.publish!
Defensive patterns

Strategy: validation

Validate before calling

return { error: 'Confirm your email first.' } unless link.user.confirmed?

Try / catch

begin
  link.publish!
rescue Link::LinkInvalid
  render json: { errors: link.errors.full_messages }, status: :unprocessable_entity
end

Prevention

When it happens

Trigger: Publishing a product (any save path running enforce_user_email_confirmation!) while link.user.confirmed? is false — new seller who never confirmed, or whose confirmation was reset.

Common situations: New sellers rushing to publish right after signup; test fixtures with unconfirmed users; email change flow that temporarily unsets confirmation.

Related errors


AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21). Data as JSON: /api/errors/13ba11d396f599cf. Report an issue: GitHub.