padrino/padrino-framework · error
Engine #{engine.inspect} is not registered with Tilt
Error message
Engine #{engine.inspect} is not registered with Tilt What it means
Padrino's render helper resolves the requested template engine through Tilt: ::Tilt[engine] when an explicit engine symbol is passed, or Tilt's default mapping when only a file path is given. If no template class is registered under that name, this RuntimeError is raised. It means the engine symbol is unknown to Tilt, most often because the template gem that registers it (slim, haml, erubi, tilt-kramdown, and so on) is not installed or not yet loaded.
Source
Thrown at padrino-helpers/lib/padrino-helpers/render_helpers.rb:73
else
render(explicit_engine, template_path, options, locals)
end
html.safe_concat content if content
end
end
alias render_partial partial
def self.included(base)
return if base.instance_methods.include?(:render) || base.private_instance_methods.include?(:render)
base.class_eval do
raise "gem 'tilt' is required" unless defined?(::Tilt)
def render(engine, file = nil, options = {}, locals = nil, &block)
options.delete(:layout)
engine, file = file, engine if file.nil?
template_engine = engine ? ::Tilt[engine] : ::Tilt.default_mapping[file]
raise "Engine #{engine.inspect} is not registered with Tilt" unless template_engine
unless File.file?(file.to_s)
engine_extensions = ::Tilt.default_mapping.extensions_for(template_engine)
file = Dir.glob("#{file}.{#{engine_extensions.join(',')}}").first || raise("Template '#{file}' not found")
end
template = template_engine.new(file.to_s, options)
template.render(options[:scope] || self, locals, &block)
end
end
end
end
end
end
View on GitHub (pinned to 167044f3d5)
Solutions
- Add the template gem that registers the engine with Tilt to your Gemfile (for example gem 'slim', gem 'haml', gem 'tilt-kramdown') in the default group and run bundle install
- Verify registration in a console with ::Tilt[:slim] — nil means the gem is still not loaded, a Class means it is registered
- Fix misspelled engine symbols; the symbol must match a registered Tilt engine name exactly (erb, erubi, haml, slim, and so on)
- Render by file path including a real extension (for example render 'views/page.slim') so Tilt's default mapping resolves the engine from the extension instead of the symbol
Example fix
# before render :md, 'README' # raises: Engine :md is not registered with Tilt # after — Gemfile: gem 'tilt-kramdown', then bundle install render :md, 'README'
Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, 'Tilt has no engine ' + engine.inspect unless defined?(::Tilt) && ::Tilt[engine] render(engine, template, options, locals)
Type guard
def registered_tilt_engine?(name) defined?(::Tilt) && ::Tilt[name].is_a?(Class) end
Prevention
- Keep template gems in the default Bundler group, not environment-specific groups
- Assert ::Tilt[engine] for every engine the app renders during boot
- Prefer rendering with real file extensions so Tilt's default mapping resolves the engine
When it happens
Trigger: Calling render :slim, 'page' (or a partial that routes through render) when the slim gem is not in the bundle; passing a misspelled engine symbol such as render :erub; using engines that Tilt 2 extracted into separate adapter gems (render :md, render :scss, render :liquid) without those gems installed; rendering before the template library has been required.
Common situations: Upgrading Tilt 1.x to 2.x, where most template engines moved out of Tilt core into standalone gems; a template gem placed only in the :development Bundler group so it works locally but raises in production; typos in engine symbols; porting Sinatra or Rails examples that assume every engine ships with the framework.
Related errors
- Role #{role} must be present and must be a symbol!
- You can't merge :any with other roles
- <= You are using '#{tmp_ext}' and for admin we only support
- Adapter #{orm} is not yet supported!
- You must define an #{settings.admin_model} Model
AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23).
Data as JSON: /api/errors/4d74a4b86244e36f.
Report an issue: GitHub.