Shopify/liquid · error · Liquid::FileSystemError
No such template '#
Error message
No such template '#{template_path}' What it means
LocalFileSystem#read_template_file raises Liquid::FileSystemError when the resolved template file does not exist on disk. The include/render name was syntactically valid and resolved to full_path, but File.exist? returned false.
Solutions
- Create the missing template file at the resolved path or fix the name in the {% include %} tag.
- Verify Liquid::Template.file_system root and pattern point at the directory containing your partials (note the underscore prefix convention).
- Add the partials to your deploy/package artifacts.
- Pre-check existence in code: File.exist?(fs.full_path(name)) before render, to fail gracefully.
Example fix
// before
Liquid::Template.file_system = Liquid::LocalFileSystem.new('app/views', '%s.liquid')
{% include 'header' %} # looks for app/views/_header.liquid -> missing
// after
mkdir -p app/views && echo '...' > app/views/_header.liquid Defensive patterns
Strategy: validation
Validate before calling
def partial_exists?(name) fs = Liquid::Template.file_system File.exist?(fs.full_path(name)) rescue Liquid::FileSystemError false end
Try / catch
begin
tpl.render(ctx)
rescue Liquid::FileSystemError => e
missing = e.message[/No such template '(.+)'/, 1]
error_reporter.notify("Missing liquid partial: #{missing}")
render_placeholder
end Prevention
- Keep partials in version control and deploy artifacts.
- Verify root and pattern settings match your naming convention (leading underscore).
- Add a boot/deploy check that scans templates for include names and asserts files exist.
- Avoid renaming/deleting partials without grepping for references.
When it happens
Trigger: {% include 'missing_partial' %} or {% render 'x' %} where root/pattern expansion (e.g. templates/_missing_partial.liquid) points to a non-existent file.
Common situations: Typo in the partial name; partial deleted or renamed while templates still reference it; wrong root directory or pattern configured (e.g. '%s.liquid' vs '_%s.liquid'); deploying without the partial files.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- This liquid context does not allow includes.
- Illegal template name '#
- Illegal template path '#
- Template.file_system=
- Nesting too deep
AI-assisted analysis of Shopify/liquid@807d45a6b3 (2026-09-08).
Data as JSON: /api/errors/5ffbb4da4e0358fc.
Report an issue: GitHub.
Appendix: source
Thrown at lib/liquid/file_system.rb:56
# Default pattern is "_%s.liquid".
#
# Example:
#
# file_system = Liquid::LocalFileSystem.new("/some/path", "%s.html")
#
# file_system.full_path("index") # => "/some/path/index.html"
#
class LocalFileSystem
attr_accessor :root
def initialize(root, pattern = "_%s.liquid")
@root = root
@pattern = pattern
end
def read_template_file(template_path)
full_path = full_path(template_path)
raise FileSystemError, "No such template '#{template_path}'" unless File.exist?(full_path)
File.read(full_path)
end
def full_path(template_path)
raise FileSystemError, "Illegal template name '#{template_path}'" unless %r{\A[^./][a-zA-Z0-9_/]+\z}.match?(template_path)
full_path = if template_path.include?('/')
File.join(root, File.dirname(template_path), @pattern % File.basename(template_path))
else
File.join(root, @pattern % template_path)
end
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path).start_with?(File.expand_path(root))
full_path
end
endView on GitHub (pinned to 807d45a6b3)