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
- Rename the file so it ends in .ru (Rack app) or .rb (Protocol::HTTP middleware)
- If the file is configuration data (YAML/JSON), load it from inside a .ru/.rb entry file instead of pointing falcon at it
- 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
- Name rackup files *.ru and protocol-middleware files *.rb; treat the extension as the interface selector
- Never point configuration_path at data files (yaml/json/toml) — load them from inside the entry file
- Assert File.extname(resolved_configuration_path) is .rb or .ru in a preflight/deploy check
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
- Could not find config/serve.rb or config.ru in #{root}!
- Unable to resolve #{hostname}!
- `Falcon::Server.middleware` is deprecated, use `.rack_middle
- Async::Container::Supervisor is replaced by Async::Service::
AI-assisted analysis of socketry/falcon@5107b0713f (2026-08-23).
Data as JSON: /api/errors/3835f392908b5c87.
Report an issue: GitHub.