forem/forem · error · StandardError

This lead form is no longer active

Error message

This lead form is no longer active

What it means

After the lookup succeeds, OrgLeadFormTag checks @form.active? and raises when the record exists but is switched off. The form is fully present in the database; the organization has simply deactivated it, so the tag refuses to embed it. The error appears the moment the containing markdown is re-parsed (save, preview, or render) after the form is deactivated.

Source

Thrown at app/liquid_tags/org_lead_form_tag.rb:10

class OrgLeadFormTag < LiquidTagBase
  PARTIAL = "liquids/org_lead_form".freeze
  VALID_CONTEXTS = %w[Organization].freeze

  def initialize(_tag_name, input, _parse_context)
    super
    @form_id = parse_form_id(input)
    @form = OrganizationLeadForm.find_by(id: @form_id)
    raise StandardError, I18n.t("liquid_tags.org_lead_form_tag.not_found") unless @form
    raise StandardError, I18n.t("liquid_tags.org_lead_form_tag.inactive") unless @form.active?

    source = parse_context.partial_options[:source]
    unless @form.organization_id == source.id
      raise StandardError, I18n.t("liquid_tags.org_lead_form_tag.wrong_organization")
    end
  end

  def render(_context)
    ApplicationController.render(
      partial: PARTIAL,
      locals: { form: @form },
    )
  end

  private

  def parse_form_id(input)
    id = Integer(input.strip, exception: false)

View on GitHub (pinned to f354c376a7)

Solutions

  1. Reactivate the form in the organization's lead form settings so existing embeds render again
  2. If deactivation was intentional, remove {% org_lead_form %} from the page markdown or replace it with a static CTA
  3. Verify state in console before touching the markdown: OrganizationLeadForm.find(42).active?

Example fix

// before: form 42 exists but is deactivated
{% org_lead_form 42 %}

// after (option A: reactivate form 42 in org settings, keep embed)
{% org_lead_form 42 %}

// after (option B: deactivation was intentional, drop the tag)
Subscribe to our newsletter!
Defensive patterns

Strategy: validation

Validate before calling

return if params[:embed_form_id].blank?

form = OrganizationLeadForm.find_by(id: params[:embed_form_id])
if form&.active?
  body << "{% org_lead_form #{form.id} %}"
else
  errors.add(:embed_form_id, 'form is missing or inactive')
end

Type guard

def lead_form_active?(form_id)
  OrganizationLeadForm.find_by(id: form_id)&.active? == true
end

Try / catch

begin
  Liquid::Template.parse(body_markdown)
rescue StandardError => e
  errors.add(:body_markdown, "Liquid tag error: #{e.message}") # 'no longer active'
end

Prevention

When it happens

Trigger: Embedding {% org_lead_form 42 %} where form 42 exists but its active flag is false, for example the org paused the lead campaign or an admin deactivated the form in settings.

Common situations: Campaign ended and the form was switched off while landing pages still embed it; bulk form deactivation during a data migration; staging data where forms are created inactive by default.

Related errors


AI-assisted analysis of forem/forem@f354c376a7 (2026-08-21). Data as JSON: /api/errors/1821721ed771ae13. Report an issue: GitHub.