{"record":{"id":"f8812bcf243aff1f","repo":"antiwork/gumroad","slug":"this-product-was-unpublished-by-gumroad-and-cannot","errorCode":null,"errorMessage":"This product was unpublished by Gumroad and cannot be republished by the seller.","messagePattern":"This product was unpublished by Gumroad and cannot be republished by the seller\\.","errorType":"exception","errorClass":"Link::LinkInvalid","httpStatus":null,"severity":"error","filePath":"app/models/link.rb","lineNumber":1657,"sourceCode":"      return unless new_record? || default_offer_code_id_changed?\n\n      # Codeless discounts (upsells, cancellation offers) are excluded: their own\n      # flows rewrite their product lists outside the detachment guards, and the\n      # discounts dashboard never offers them as defaults.\n      if !user.offer_codes.alive.where.not(code: nil).where(id: default_offer_code.id).exists?\n        errors.add(:default_offer_code, \"must belong to your offer codes\")\n      elsif default_offer_code.inactive?\n        errors.add(:default_offer_code, \"cannot be expired\")\n      elsif !default_offer_code.applicable?(self)\n        errors.add(:default_offer_code, \"must apply to this product\")\n      end\n    end\n\n    def enforce_not_unpublished_by_admin!\n      return unless is_unpublished_by_admin?\n\n      errors.add(:base, \"This product was unpublished by Gumroad and cannot be republished by the seller.\")\n      raise LinkInvalid, \"This product was unpublished by Gumroad and cannot be republished by the seller.\"\n    end\n\n    def enforce_user_email_confirmation!\n      return if user.confirmed?\n\n      errors.add(:base, \"You have to confirm your email address before you can do that.\")\n      raise LinkInvalid, \"You have to confirm your email address before you can do that.\"\n    end\n\n    def enforce_shipping_destinations_presence!\n      return unless is_physical\n      return if shipping_destinations.alive.present?\n\n      errors.add(:base, \"The product needs to be shippable to at least one destination.\")\n      raise LinkInvalid, \"The product needs to be shippable to at least one destination.\"\n    end\n\n    def enforce_merchant_account_exits_for_new_users!","sourceCodeStart":1639,"sourceCodeEnd":1675,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/models/link.rb#L1639-L1675","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do not attempt programmatic republish; this flag can only be cleared by Gumroad staff — respond to the takedown notice / contact support.","Hide the publish affordance when is_unpublished_by_admin? is set so sellers aren't led into the error.","Rescue Link::LinkInvalid and show errors.full_messages verbatim to the seller."],"exampleFix":"# before\nlink.publish! # LinkInvalid: unpublished by Gumroad\n\n# after\nif link.is_unpublished_by_admin?\n  return { error: \"This product was unpublished by Gumroad and cannot be republished by the seller.\" }\nend\nlink.publish!","handlingStrategy":"validation","validationCode":"return { blocked: true } if link.is_unpublished_by_admin?","typeGuard":null,"tryCatchPattern":"begin\n  link.publish!\nrescue Link::LinkInvalid\n  render json: { errors: link.errors.full_messages }, status: :unprocessable_entity # only Gumroad staff can clear this flag\nend","preventionTips":["Hide Publish affordances on admin-unpublished products.","Treat the flag as terminal for seller-side flows; escalate to support instead of retrying.","Watch for stale edit pages still showing Publish after a takedown."],"tags":["links","publishing","moderation","admin-action","rails","linkinvalid"],"backgroundTag":"operation-not-permitted","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}