jekyll: [Bug]: Can't serve and build pages with ruby 3.2

Operating System

Mac OS 13.1

Ruby Version

ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

Jekyll Version

jekyll 4.3.1

GitHub Pages Version

No response

Expected Behavior

I’m having a little bit of trouble serving my site running on Ruby 3.2

bundle exec jekyll serve --trace

It looks like this is a problem with liquid. It appears to be fixed in https://github.com/Shopify/liquid/issues/1625 and released in v5. It’s also a good idea to keep gem dependencies on this project up to date. Can we look into getting jekyll updated to this version of liquid so this works with the latest version of ruby?

Current Behavior

bundle exec jekyll serve

Configuration file: /Users/matt/dev/play/charlotte-ruby.github.io/_config.yml
            Source: /Users/matt/dev/play/charlotte-ruby.github.io
       Destination: /Users/matt/dev/play/charlotte-ruby.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
  Liquid Exception: undefined method `tainted?' for nil:NilClass in /Users/matt/dev/play/charlotte-ruby.github.io/_layouts/post.html
                    ------------------------------------------------
      Jekyll 4.3.1   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
/Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?' for nil:NilClass (NoMethodError)

      return unless obj.tainted?
                       ^^^^^^^^^

Relevant log output

bundle exec jekyll serve --trace
Configuration file: /Users/matt/dev/play/charlotte-ruby.github.io/_config.yml
            Source: /Users/matt/dev/play/charlotte-ruby.github.io
       Destination: /Users/matt/dev/play/charlotte-ruby.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
  Liquid Exception: undefined method `tainted?' for nil:NilClass in /Users/matt/dev/play/charlotte-ruby.github.io/_layouts/post.html
bundler: failed to load command: jekyll (/Users/matt/.asdf/installs/ruby/3.2.0/bin/jekyll)
/Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?' for nil:NilClass (NoMethodError)

      return unless obj.tainted?
                       ^^^^^^^^^
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:89:in `render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/tags/assign.rb:26:in `render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:91:in `render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/renderer.rb:129:in `render_liquid'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/renderer.rb:192:in `render_layout'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/renderer.rb:161:in `place_in_layouts'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/renderer.rb:93:in `render_document'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/renderer.rb:63:in `run'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:578:in `render_regenerated'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:563:in `block (2 levels) in render_docs'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:562:in `each'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:562:in `block in render_docs'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:561:in `each_value'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:561:in `render_docs'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:210:in `render'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:80:in `process'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:28:in `process_site'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:65:in `build'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:36:in `process'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `each'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
	from /Users/matt/.asdf/installs/ruby/3.2.0/bin/jekyll:25:in `load'
	from /Users/matt/.asdf/installs/ruby/3.2.0/bin/jekyll:25:in `<top (required)>'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:491:in `exec'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:45:in `block in <top (required)>'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /Users/matt/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:33:in `<top (required)>'
	from /Users/matt/.asdf/installs/ruby/3.2.0/bin/bundle:25:in `load'
	from /Users/matt/.asdf/installs/ruby/3.2.0/bin/bundle:25:in `<main>'

Code Sample

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 19
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Resolved with release of Liquid 4.0.4

To Everyone intending to use Jekyll on Ruby 3.2, we have decided to patch the issue at our end with #9248. Please point your Gemfile to the pull request and let us know if your build still fails:

# in your Gemfile
gem "jekyll", github: "jekyll/jekyll", ref: "refs/pull/9248/head"

Looks like this has been resolved with liquid 4.0.4 release. Since the gemspec brings in ~> 4, this should get fixed by simply running bundle. Thanks guys!

To Everyone intending to use Jekyll on Ruby 3.2, we have decided to patch the issue at our end with #9248. Please point your Gemfile to the pull request and let us know if your build still fails:

# in your Gemfile
gem "jekyll", github: "jekyll/jekyll", ref: "refs/pull/9248/head"

Using the PR version instead fixes the issue in my build with 3.2.0 👍🏻

To Everyone intending to use Jekyll on Ruby 3.2, we have decided to patch the issue at our end with #9248. Please point your Gemfile to the pull request and let us know if your build still fails:

# in your Gemfile
gem "jekyll", github: "jekyll/jekyll", ref: "refs/pull/9248/head"

Hey @ashmaroli, hope you’re doing fine. Thx a lot for the workaround, it worked out for me 👍 Hope the #9248 is gonna be merged anytime soon 🙏

I had the same issue today. I can it helps anyone out there, this is how I temporarily solved it.

I’m using jekyll in gitlab pages, so the .gitlab-ci.yml file was using image image: ruby:latest. Changed it to image:ruby:3.1 and my page started publishing again fine. It is of course a temp solution, and I’ll switch it back to latest as soon as this issue is resolved.