padrino/padrino-framework · error

Rack config file `#{config_file}` must have `.ru` extension

Error message

Rack config file `#{config_file}` must have `.ru` extension

What it means

Error "Rack config file `#{config_file}` must have `.ru` extension" thrown in padrino/padrino-framework.

Source

Thrown at padrino-core/lib/padrino-core/server.rb:22

  # thin, mongrel, or WEBrick in that order.
  #
  # @example
  #   Padrino.run! # with these defaults => host: '127.0.0.1', port: '3000', adapter: the first found
  #   Padrino.run!('0.0.0.0', '4000', 'mongrel') # use => host: '0.0.0.0', port: '4000', adapter: 'mongrel'
  #
  def self.run!(options = {})
    Padrino.load!
    Server.start(*detect_application(options))
  end

  def self.detect_application(options)
    default_config_file = 'config.ru'

    config_file = options.delete(:config)
    config_file ||= default_config_file if File.file?(default_config_file)
    return [Padrino.application, options] unless config_file

    raise "Rack config file `#{config_file}` must have `.ru` extension" unless config_file =~ /\.ru$/
    rack_app, rack_options = Rack::Builder.parse_file(config_file)
    [rack_app, (rack_options || {}).merge(options)]
  end

  ##
  # This module builds a Padrino server to run the project based on available handlers.
  #
  class Server < Rackup::Server
    DEFAULT_ADDRESS = { Host: '127.0.0.1', Port: 3000 }

    # Server Handlers
    Handlers = %i[thin puma spider-gazelle mongrel trinidad webrick]

    # Starts the application on the available server with specified options.
    def self.start(app, options = {})
      options = Utils.symbolize_keys(options.to_hash)
      options.update(parse_server_options(options.delete(:options)))
      options.update(detect_address(options))

View on GitHub (pinned to 167044f3d5)

When it happens

Trigger: Thrown at padrino-core/lib/padrino-core/server.rb:22 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/7e32caed84c1eba7. Report an issue: GitHub.