{"record":{"id":"419aab307ca51d16","repo":"Shopify/liquid","slug":"template-error-mode-is-deprecated-use-environmen","errorCode":null,"errorMessage":"Template.error_mode= is deprecated. Use Environment#error_mode= instead.","messagePattern":"Template\\.error_mode= is deprecated\\. Use Environment#error_mode= instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/liquid/template.rb","lineNumber":30,"sourceCode":"  # Example:\n  #\n  #   template = Liquid::Template.parse(source)\n  #   template.render('user_name' => 'bob')\n  #\n  class Template\n    attr_accessor :root, :name\n    attr_reader :resource_limits, :warnings\n\n    attr_reader :profiler\n\n    class << self\n      # Sets how strict the parser should be.\n      # :lax acts like liquid 2.5 and silently ignores malformed tags in most cases.\n      # :warn is the default and will give deprecation warnings when invalid syntax is used.\n      # :strict enforces correct syntax for most tags\n      # :strict2 enforces correct syntax for all tags\n      def error_mode=(mode)\n        Deprecations.warn(\"Template.error_mode=\", \"Environment#error_mode=\")\n        Environment.default.error_mode = mode\n      end\n\n      def error_mode\n        Environment.default.error_mode\n      end\n\n      def default_exception_renderer=(renderer)\n        Deprecations.warn(\"Template.default_exception_renderer=\", \"Environment#exception_renderer=\")\n        Environment.default.exception_renderer = renderer\n      end\n\n      def default_exception_renderer\n        Environment.default.exception_renderer\n      end\n\n      def file_system=(file_system)\n        Deprecations.warn(\"Template.file_system=\", \"Environment#file_system=\")","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/template.rb#L12-L48","documentation":"Assigning Liquid::Template.error_mode= goes through Liquid's deprecation shim, which forwards to Environment#error_mode= and emits a deprecation warning. Template-level global setters were replaced by the Liquid::Environment API, and this path will be removed in a future major version.","triggerScenarios":"Calling Liquid::Template.error_mode = :strict (or :lax/:warn/:strict2) anywhere in app code or test setup.","commonSituations":"Upgrading Liquid from 4.x/5.x to 5.5+ where template-level globals were deprecated; old initializers setting parse strictness on Template instead of Environment.","solutions":["Replace with Liquid::Environment.default.error_mode = mode or set error_mode on a dedicated Environment instance passed to Template.parse","Silence via Liquid::Deprecations if temporarily unavoidable, but plan the migration"],"exampleFix":"// before\nLiquid::Template.error_mode = :strict\n// after\nLiquid::Environment.default.error_mode = :strict","handlingStrategy":"validation","validationCode":"warn 'Template.error_mode= is deprecated' if Liquid::Template.respond_to?(:error_mode=) && deprecated_call_site","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure Liquid exclusively through Liquid::Environment going forward","Add a deprecation-warning collector in tests and fail the build on new warnings","Search codebases for 'Template.error_mode' during Liquid upgrades"],"tags":["ruby","liquid","deprecation"],"backgroundTag":"deprecated-api-usage","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"}