socketry/falcon · error · ArgumentError

Unsupported application configuration: #{path}!

Error message

Unsupported application configuration: #{path}!

What it means

After resolving the configuration path, Falcon::Environment::Serve#middleware dispatches on File.extname(path): '.rb' files load through Protocol::HTTP::Middleware.load and '.ru' files parse through Protocol::Rack::Adapter.parse_file (lib/falcon/environment/serve.rb:60-69). The extension is the explicit contract selecting the application interface, since both loaded objects simply respond to call. Any other extension — or no extension at all — hits the else branch and raises ArgumentError naming the offending path.

Source

Thrown at lib/falcon/environment/serve.rb:68

				end
				
				raise ArgumentError, "Could not find config/serve.rb or config.ru in #{root}!"
			end
			
			# Load and wrap the configured application.
			# @returns [Protocol::HTTP::Middleware] The middleware stack.
			def middleware
				path = resolved_configuration_path
				
				case File.extname(path)
				when ".rb"
					application = ::Protocol::HTTP::Middleware.load(path)
					return ::Falcon::Server.protocol_middleware(application, verbose: verbose, cache: cache)
				when ".ru"
					application = ::Protocol::Rack::Adapter.parse_file(path)
					return ::Falcon::Server.rack_middleware(application, verbose: verbose, cache: cache)
				else
					raise ArgumentError, "Unsupported application configuration: #{path}!"
				end
			end
		end
	end
end

View on GitHub (pinned to 5107b0713f)

Solutions

  1. Rename the file so it ends in .ru (Rack app) or .rb (Protocol::HTTP middleware)
  2. If the file is configuration data (YAML/JSON), load it from inside a .ru/.rb entry file instead of pointing falcon at it
  3. Verify with File.extname — '.ru' must be exact; config.ru.txt fails because extname is '.txt'

Example fix

# before
class MyAppEnvironment
  include Falcon::Environment::Serve

  def configuration_path
    'config/falcon.yaml' # -> ArgumentError: Unsupported application configuration
  end
end

# after
class MyAppEnvironment
  include Falcon::Environment::Serve

  def configuration_path
    'config/falcon.ru' # .ru = Rack app; .rb = Protocol::HTTP middleware
  end
end
Defensive patterns

Strategy: validation

Validate before calling

path = environment.resolved_configuration_path
unless %w[.rb .ru].include?(File.extname(path))
  abort "#{path}: falcon only loads .rb or .ru app configs (got #{File.extname(path).inspect})"
end

Try / catch

begin
  middleware = environment.middleware
rescue ArgumentError => error
  abort "falcon serve: #{error.message}"
end

Prevention

When it happens

Trigger: Setting configuration_path (or having discovery land on) a file whose extname is not exactly .rb or .ru — e.g. config/app.yaml, config/falcon.json, config.ru.txt, or an extensionless config/app — then calling middleware on the serve environment.

Common situations: Pointing falcon at a YAML/JSON settings file expecting it to be read; editors, uploads, or backups renaming config.ru to config.ru.txt or app.ru.bak; extensionless entry scripts; case-mismatched extensions like .RU.

Related errors


AI-assisted analysis of socketry/falcon@5107b0713f (2026-08-23). Data as JSON: /api/errors/3835f392908b5c87. Report an issue: GitHub.