antiwork/gumroad · error · Link::LinkInvalid

This product was unpublished by Gumroad and cannot be republ

Error message

This product was unpublished by Gumroad and cannot be republished by the seller.

What it means

Raised as Link::LinkInvalid by Link#enforce_not_unpublished_by_admin! when republishing a product flagged is_unpublished_by_admin?. This is a trust-and-safety hold: Gumroad staff unpublished the product, and the seller-side publish path refuses to reverse that decision. The error is also added to the model's :base so callers can render it without parsing the exception.

Source

Thrown at app/models/link.rb:1657

      return unless new_record? || default_offer_code_id_changed?

      # Codeless discounts (upsells, cancellation offers) are excluded: their own
      # flows rewrite their product lists outside the detachment guards, and the
      # discounts dashboard never offers them as defaults.
      if !user.offer_codes.alive.where.not(code: nil).where(id: default_offer_code.id).exists?
        errors.add(:default_offer_code, "must belong to your offer codes")
      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!

View on GitHub (pinned to afeacbd394)

Solutions

  1. Do not attempt programmatic republish; this flag can only be cleared by Gumroad staff — respond to the takedown notice / contact support.
  2. Hide the publish affordance when is_unpublished_by_admin? is set so sellers aren't led into the error.
  3. Rescue Link::LinkInvalid and show errors.full_messages verbatim to the seller.

Example fix

# before
link.publish! # LinkInvalid: unpublished by Gumroad

# after
if link.is_unpublished_by_admin?
  return { error: "This product was unpublished by Gumroad and cannot be republished by the seller." }
end
link.publish!
Defensive patterns

Strategy: validation

Validate before calling

return { blocked: true } if link.is_unpublished_by_admin?

Try / catch

begin
  link.publish!
rescue Link::LinkInvalid
  render json: { errors: link.errors.full_messages }, status: :unprocessable_entity # only Gumroad staff can clear this flag
end

Prevention

When it happens

Trigger: Any save/publish path that runs enforce_not_unpublished_by_admin! on a link whose is_unpublished_by_admin? flag is true — i.e. the seller hits Publish on a product Gumroad took down.

Common situations: Product removed for policy/DMZ/payment-review reasons; seller edits the product and attempts to re-list it; stale edit page still showing a Publish button after the takedown.

Related errors


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