Skip to content
Latchkey

Bridgetown "could not be built" Liquid error in CI

Bridgetown renders content with Liquid (and Ruby components). A Liquid syntax error, an undefined variable, or a failing component makes a page fail to build, and bridgetown deploy exits non-zero.

What this error means

bridgetown deploy reports "Liquid error" or that a page "could not be built", naming the template and the underlying Liquid or Ruby message.

bridgetown
Liquid Exception: Liquid syntax error (line 10): Unknown tag 'endif' in /src/_layouts/post.liquid
  Page "posts/hello.md" could not be built.

Common causes

A Liquid syntax error in a layout

A mismatched tag (using endif for an unless, or an unclosed block) makes Liquid fail to parse the template.

An undefined variable or failing component

A template references data missing for some pages, or a Ruby component raises during render.

How to fix it

Fix the Liquid tag the error names

  1. Open the layout at the reported line.
  2. Close blocks with the matching end tag (endif/endunless/endfor).
  3. Re-run the build to confirm the page renders.
Terminal
bin/bridgetown deploy

Default missing template data

Guard optional fields so a missing value does not break the render.

src/_layouts/post.liquid
{{ page.author | default: site.metadata.author }}

How to prevent it

  • Match every Liquid block to its correct end tag.
  • Default optional front matter in layouts.
  • Build locally before deploying in CI.

Frequently asked questions

What causes ""could not be built" (Bridgetown)"?
A mismatched tag (using endif for an unless, or an unclosed block) makes Liquid fail to parse the template.
How do I fix "could not be built" (Bridgetown)?
Fix the Liquid tag the error names

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card