Shopify/liquid · warning · Liquid::Tag::DisabledError

# #

Error message

#{tag_name} #{parse_context[:locale].t('errors.disabled.tag')}

What it means

`disabled_error` raises Liquid's DisabledError with a localized message ("#{tag_name} ...errors.disabled.tag") when a disableable tag (e.g. an include/render or custom tag) is rendered while disabled via parse/render context configuration. The method immediately rescues and passes the exception through `context.handle_error`, so the context's exception_renderer decides whether to re-raise or record the error in output.

Solutions

  1. Enable the tag in the context configuration if the template legitimately needs it (remove it from the disabled tags list).
  2. Rewrite the template to avoid the disabled tag (e.g. inline partials instead of include).
  3. Provide a custom exception_renderer that handles DisabledError gracefully (log and render blank) instead of raising to the user.
  4. Inform template authors which tags are available; document the disabled tag policy.
  5. If DisabledError should propagate, ensure the exception renderer re-raises; otherwise catch Liquid::Error in your render call.

Example fix

// before
template.render(assigns) # raises/records DisabledError for include
// after
begin
  template.render(assigns)
rescue Liquid::DisabledError => e
  logger.warn("disabled tag used: #{e.message}")
  ""
end
Defensive patterns

Strategy: try-catch

Validate before calling

# before render
raise "template uses disabled tag include" if src =~ /{%-?\s*include\s/ && disabled_tags.include?('include')

Type guard

def tags_allowed?(src, disabled_tags)
  disabled_tags.none? { |t| src.match?(/{%-?\s*#{Regexp.escape(t)}[\s%]/) }
end

Try / catch

begin
  template.render(assigns)
rescue Liquid::DisabledError => e
  log_disabled_tag_usage(e)
  ""
end

Prevention

When it happens

Trigger: Rendering a template containing a disabled tag while the tag was disabled via context options (e.g. `{% include %}` disabled with disabled tags config), causing DisabledError at render time on that tag's line.

Common situations: Sandboxed/untrusted template rendering where include/render are disabled for security; environments disabling tags for performance; admin previews with restricted tag sets; users pasting templates that rely on tags the host application disables.

Related errors


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

Appendix: source

Thrown at lib/liquid/tag/disableable.rb:16

# frozen_string_literal: true

module Liquid
  class Tag
    module Disableable
      def render_to_output_buffer(context, output)
        if context.tag_disabled?(tag_name)
          output << disabled_error(context)
          return
        end
        super
      end

      def disabled_error(context)
        # raise then rescue the exception so that the Context#exception_renderer can re-raise it
        raise DisabledError, "#{tag_name} #{parse_context[:locale].t('errors.disabled.tag')}"
      rescue DisabledError => exc
        context.handle_error(exc, line_number)
      end
    end
  end
end

View on GitHub (pinned to 807d45a6b3)