padrino/padrino-framework · error · ArgumentError

app is required

Error message

app is required

What it means

Error "app is required" thrown in padrino/padrino-framework.

Source

Thrown at padrino-core/lib/padrino-core/router.rb:58

    # @option options [Sinatra::Application] :to
    #  The class of the application to mount.
    # @option options [String] :path ("/")
    #  The path to map the specified application.
    # @option options [String] :host
    #  The host to map the specified application.
    #
    # @example
    #  map(path: '/', to: PadrinoWeb, host: 'padrino.local')
    #
    # @return [Array] The sorted route mappings.
    # @api semipublic
    def map(options = {})
      path = options[:path] || '/'
      host = options[:host]
      app  = options[:to]

      raise ArgumentError, 'paths need to start with /' if path[0] != '/'
      raise ArgumentError, 'app is required' if app.nil?

      path  = path.chomp('/')
      match = Regexp.new("^#{Regexp.quote(path).gsub('/', '/+')}(.*)", Regexp::NOENCODING)
      host  = Regexp.new("^#{Regexp.quote(host)}$", Regexp::NOENCODING) unless host.nil? || host.is_a?(Regexp)

      @mapping << [host, path, match, app]
    end

    # The call handler setup to route a request given the mappings specified.
    def call(env)
      began_at = Time.now
      path_info = env['PATH_INFO'].to_s
      script_name = env['SCRIPT_NAME']
      http_host = env['HTTP_HOST']
      last_result = nil

      @mapping.each do |host, path, match, app|
        next unless host.nil? || http_host =~ host

View on GitHub (pinned to 167044f3d5)

When it happens

Trigger: Thrown at padrino-core/lib/padrino-core/router.rb:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/f2730d88dd46e1a0. Report an issue: GitHub.