nesquena/rabl · error · RuntimeError

Cannot find rabl template '#{file}' within registered (#{vie

Error message

Cannot find rabl template '#{file}' within registered (#{view_paths.map(&:to_s).inspect}) view paths!

What it means

Error "Cannot find rabl template '#{file}' within registered (#{view_paths.map(&:to_s).inspect}) view paths!" thrown in nesquena/rabl.

Source

Thrown at lib/rabl/sources.rb:26

      custom_view_path = Array(options[:view_path])

      Rabl.source_cache(file, custom_view_path) do
        view_paths = custom_view_path + Array(Rabl.configuration.view_paths)

        file_path = \
          if defined?(Padrino) && context_scope.respond_to?(:settings) && context_scope.respond_to?(:resolve_template)
            fetch_padrino_source(file, options)
          elsif defined?(Rails) && context_scope.respond_to?(:view_paths)
            _view_paths = view_paths + Array(context_scope.view_paths.to_a)
            fetch_rails_source(file, options) || fetch_manual_template(_view_paths, file)
          elsif defined?(Sinatra) && context_scope.respond_to?(:settings) && context_scope.settings.respond_to?(:views)
            fetch_sinatra_source(file, options)
          else # generic template resolution
            fetch_manual_template(view_paths, file)
          end

        unless File.exist?(file_path.to_s)
          raise "Cannot find rabl template '#{file}' within registered (#{view_paths.map(&:to_s).inspect}) view paths!"
        end

        [File.read(file_path.to_s), file_path.to_s]
      end
    end

    private
      # Returns the rabl template path for padrino views using configured views
      def fetch_padrino_source(file, options = {})
        view_path = Array(options[:view_path] || context_scope.settings.views)

        # use Padrino's own template resolution mechanism
        file_path, _ = context_scope.instance_eval { resolve_template(file) }

        # Padrino chops the extension, stitch it back on
        File.join(view_path.first.to_s, (file_path.to_s + ".rabl"))
      end

View on GitHub (pinned to 9a16f842ad)

When it happens

Trigger: Thrown at lib/rabl/sources.rb:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nesquena/rabl@9a16f842ad (2026-08-23). Data as JSON: /api/errors/57c1d6c542bee44e. Report an issue: GitHub.