{"record":{"id":"ecf0f93858e60bdf","repo":"Shopify/liquid","slug":"profiler-not-loaded-require-liquid-profiler-fir","errorCode":null,"errorMessage":"Profiler not loaded, require 'liquid/profiler' first","messagePattern":"Profiler not loaded, require 'liquid/profiler' first","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/liquid/template.rb","lineNumber":223,"sourceCode":"        end\n        @errors = context.errors\n      end\n    end\n\n    def render!(*args)\n      @rethrow_errors = true\n      render(*args)\n    end\n\n    def render_to_output_buffer(context, output)\n      render(context, output: output)\n    end\n\n    private\n\n    def configure_options(options)\n      if (profiling = options[:profile])\n        raise \"Profiler not loaded, require 'liquid/profiler' first\" unless defined?(Liquid::Profiler)\n      end\n\n      @options      = options\n      @profiling    = profiling\n      @line_numbers = options[:line_numbers] || @profiling\n      parse_context = if options.is_a?(ParseContext)\n        options\n      else\n        opts = options.key?(:environment) ? options : options.merge(environment: @environment)\n        ParseContext.new(opts)\n      end\n\n      @warnings = parse_context.warnings\n      @error_mode = parse_context.error_mode\n      parse_context\n    end\n\n    def apply_options_to_context(context, options)","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/template.rb#L205-L241","documentation":"Liquid raises this plain RuntimeError when Template#parse is called with the :profile option but the profiling support classes were never loaded. Profiling code is kept out of the default load path for performance, so the caller must explicitly require 'liquid/profiler' before profiling can be enabled. configure_options checks defined?(Liquid::Profiler) and aborts parsing otherwise.","triggerScenarios":"Calling Template.parse(source, profile: true) (or Liquid::Environment with profile) without a prior require 'liquid/profiler' in the process.","commonSituations":"Enabling profiling in production config or an initializer while the profiler require lives only in a dev/test helper; upgrading Liquid where profiling became opt-in; copying a profiling snippet into a new app entry point.","solutions":["Add require 'liquid/profiler' at the top of the file or Gemfile-level initializer before any parse with profile: true","Move the require into a boot/initializer so it runs before templates are parsed","Guard the profiling branch with defined?(Liquid::Profiler) and skip profiling if absent"],"exampleFix":"// before\nLiquid::Template.parse(template_source, profile: true)\n// after\nrequire 'liquid/profiler'\nLiquid::Template.parse(template_source, profile: true)","handlingStrategy":"validation","validationCode":"raise 'profiling requested but liquid/profiler not loaded' if options[:profile] && !defined?(Liquid::Profiler)\nrequire 'liquid/profiler' if options[:profile]","typeGuard":"def profiler_available? = defined?(Liquid::Profiler) ? true : false","tryCatchPattern":null,"preventionTips":["Require 'liquid/profiler' in the Gemfile-level initializer whenever profiling may be enabled","Gate profiling code behind a single configure method that performs the require","Keep profiling setup out of conditional branches that only run in some environments"],"tags":["ruby","liquid","profiling","configuration"],"backgroundTag":"missing-dependency","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"}