Shopify/liquid · warning

[DEPRECATION] # is deprecated. Use # instead. Called from #…

Error message

[DEPRECATION] #{name} is deprecated. Use #{alternative} instead. Called from #{caller_location}\n

What it means

Liquid::Deprecations.warn is the internal deprecation reporting helper: it records the deprecated name once per process and writes a [DEPRECATION] line to Warning.warn naming the replacement and the caller location. Seeing this message means the code path taken uses a deprecated Liquid API that will be removed in a future release.

Solutions

  1. Follow the message's 'Use X instead' guidance and migrate to the Environment API
  2. Call each deprecated API at most once or filter warnings, since the message is emitted once per name per process
  3. Route Warning.warn to your logger to inventory which deprecated calls fire at boot

Example fix

// before
Liquid::Template.register_tag('mytag', MyTag)
// after
Liquid::Environment.default.register_tag('mytag', MyTag)
Defensive patterns

Strategy: fallback

Validate before calling

Liquid::Warning.method(:warn) # route to logger to inventory deprecated calls

Try / catch

# custom warning handler
def MyLogger.warn(msg)
  Rails.logger.warn(msg) if msg.include?('[DEPRECATION]')
end

Prevention

When it happens

Trigger: Any deprecated Liquid API call, e.g. Template.error_mode=, Template.file_system=, Template.register_tag/register_filter, Template.default_* setters, Condition#evaluate without context, :rigid error mode — each forwards through this warn.

Common situations: App or gem initializers written against pre-Environment Liquid APIs; test suites surfacing warnings only when run with -W or a custom Warning handler.

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/b798e4341864c60d. Report an issue: GitHub.

Appendix: source

Thrown at lib/liquid/deprecations.rb:18

# frozen_string_literal: true

require "set"

module Liquid
  class Deprecations
    class << self
      attr_accessor :warned

      Deprecations.warned = Set.new

      def warn(name, alternative)
        return if warned.include?(name)

        warned << name

        caller_location = caller_locations(2, 1).first
        Warning.warn("[DEPRECATION] #{name} is deprecated. Use #{alternative} instead. Called from #{caller_location}\n")
      end
    end
  end
end

View on GitHub (pinned to 807d45a6b3)