Shopify/liquid · warning

:rigid is deprecated. Use :strict2 instead.

Error message

:rigid is deprecated. Use :strict2 instead.

What it means

Using the :rigid error mode triggers a deprecation notice via Deprecations.warn: :rigid was renamed to :strict2, which enforces correct syntax for all tags. Behavior is identical; only the name changed, and :rigid will eventually be removed.

Solutions

  1. Replace :rigid with :strict2 wherever error_mode is set
  2. Validate user-supplied error modes against the canonical set [:lax, :warn, :strict, :strict2]

Example fix

// before
Liquid::Template.parse(src, error_mode: :rigid)
// after
Liquid::Template.parse(src, error_mode: :strict2)
Defensive patterns

Strategy: validation

Validate before calling

VALID_MODES = %i[lax warn strict strict2].freeze
raise ArgumentError, "bad error_mode #{mode}" unless VALID_MODES.include?(mode)

Type guard

def valid_error_mode?(m) %i[lax warn strict strict2].include?(m.to_s.to_sym) end

Prevention

When it happens

Trigger: Setting error_mode: :rigid in Template.parse options, an Environment, or a parse_context used by parser-switching tags.

Common situations: Code copied from Liquid forks/older Shopify branches that used :rigid; config DSLs that expose error mode strings from user input.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of Shopify/liquid@807d45a6b3 (2026-09-08). Data as JSON: /api/errors/68cd70d6157d6b7e. Report an issue: GitHub.

Appendix: source

Thrown at lib/liquid/parser_switching.rb:55

      when :lax     then lax_parse(markup)
      when :warn
        begin
          strict2_parse_with_error_context(markup)
        rescue SyntaxError => e
          parse_context.warnings << e
          lax_parse(markup)
        end
      end
    end

    def strict2_mode?
      parse_context.error_mode == :strict2 || parse_context.error_mode == :rigid
    end

    private

    def rigid_warn
      Deprecations.warn(':rigid', ':strict2')
    end

    def strict2_parse_with_error_context(markup)
      strict2_parse(markup)
    rescue SyntaxError => e
      e.line_number    = line_number
      e.markup_context = markup_context(markup)
      raise e
    end

    def strict_parse_with_error_context(markup)
      strict_parse(markup)
    rescue SyntaxError => e
      e.line_number    = line_number
      e.markup_context = markup_context(markup)
      raise e
    end

View on GitHub (pinned to 807d45a6b3)