{"record":{"id":"a8dcd6248d85a35e","repo":"Shopify/liquid","slug":"tag-name-parse-context-locale-t-errors-dis","errorCode":null,"errorMessage":"#{tag_name} #{parse_context[:locale].t('errors.disabled.tag')}","messagePattern":"#\\{tag_name\\} #\\{parse_context\\[:locale\\]\\.t\\('errors\\.disabled\\.tag'\\)\\}","errorType":"exception","errorClass":"Liquid::Tag::DisabledError","httpStatus":null,"severity":"warning","filePath":"lib/liquid/tag/disableable.rb","lineNumber":16,"sourceCode":"# frozen_string_literal: true\n\nmodule Liquid\n  class Tag\n    module Disableable\n      def render_to_output_buffer(context, output)\n        if context.tag_disabled?(tag_name)\n          output << disabled_error(context)\n          return\n        end\n        super\n      end\n\n      def disabled_error(context)\n        # raise then rescue the exception so that the Context#exception_renderer can re-raise it\n        raise DisabledError, \"#{tag_name} #{parse_context[:locale].t('errors.disabled.tag')}\"\n      rescue DisabledError => exc\n        context.handle_error(exc, line_number)\n      end\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/tag/disableable.rb#L1-L23","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable the tag in the context configuration if the template legitimately needs it (remove it from the disabled tags list).","Rewrite the template to avoid the disabled tag (e.g. inline partials instead of include).","Provide a custom exception_renderer that handles DisabledError gracefully (log and render blank) instead of raising to the user.","Inform template authors which tags are available; document the disabled tag policy.","If DisabledError should propagate, ensure the exception renderer re-raises; otherwise catch Liquid::Error in your render call."],"exampleFix":"// before\ntemplate.render(assigns) # raises/records DisabledError for include\n// after\nbegin\n  template.render(assigns)\nrescue Liquid::DisabledError => e\n  logger.warn(\"disabled tag used: #{e.message}\")\n  \"\"\nend","handlingStrategy":"try-catch","validationCode":"# before render\nraise \"template uses disabled tag include\" if src =~ /{%-?\\s*include\\s/ && disabled_tags.include?('include')","typeGuard":"def tags_allowed?(src, disabled_tags)\n  disabled_tags.none? { |t| src.match?(/{%-?\\s*#{Regexp.escape(t)}[\\s%]/) }\nend","tryCatchPattern":"begin\n  template.render(assigns)\nrescue Liquid::DisabledError => e\n  log_disabled_tag_usage(e)\n  \"\"\nend","preventionTips":["Document the disabled-tag policy for template authors","Configure a custom exception_renderer for graceful DisabledError handling","Scan user templates for disabled tags at submission time","Keep disabled tag lists consistent across environments"],"tags":["liquid","disabled-tag","sandbox","template"],"backgroundTag":"operation-not-supported","analyzedSha":"807d45a6b3d4568e64e86b375e3702df2c7c860c","analyzedAt":"2026-09-08T11:31:38.917Z","contentChangedAt":"2026-09-08T11:31:38.917Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}