Liquid 4.0.3 "tainted"

I regularly update my Jekyll environment. This morning much was updated, and an unmentionable strings of errors ensued, the most important hint being libruby.3.1.dylib (LoadError). After unfruitful digging for advice I simply deleted my gems folder, much better.
Now: Jekyll can be started e.g. with jekyll -v (gives 4.3.1), ruby is 3.2.0, but running jekyll serve or similar results in “Liquid Exception: undefined method tainted? …”. I see in the liquid issues this was resolved in liquid ≥5.0, I have liquid-4.0.3. How can I force a “higher” liquid version? I deleted my Gemfile.lock file, but on regenerating I note that it says liquid (~> 4.0) under the jekyll tag.
Please advise. Thanking you in advance, Michael

2 Likes

Adding to my own question… I see from a posting by chuckhoupt “Unfortunately, liquid v5 is not backwards compatible” And I see on GitHub that this is still being worked upon.
So how do I avoid my “tainted” problem? And why does nobody else have the same problem :slight_smile: ?

Or downgrade Jekyll from 4.3.1 to 4.3.0 (which runs well on my other machine), how?

Hello @michaelbach,
This is more of a Ruby issue than a Jekyll issue.
Ruby 3.2.0 has removed a bunch of methods from the top level Object class (all of which were deprecated in previous versions of Ruby). This includes methods such as tainted?. Details can be found in the release post for Ruby 3.2.0.
So, downgrading Jekyll is pointless.

You are not the only facing the issue.

Theoretically, Jekyll could just re-insert the removed methods and cut new release(s). But ideally, Jekyll should not be messing core classes of the language.

The best solution would be getting the Liquid team to release a patch that doesn’t use any of the removed methods in their codebase. That would automatically resolve this issue for ALL fairly recently versions of Jekyll.

1 Like

Thank you for a rapid and clear explanation! I understand. Indeed, in the meantime I had found out how to “downgrade” Jekyll, and, as you say, it did not resolve the issue. Glad to hear I’m not the only one :). Very awkward situation right now for Jekyllers. I’m glad I have a working version (ruby 3.1.2) on another machine…
How will we learn when this is resolved?

Would it help in the meantime to install an older ruby version with, e.g. chruby?

You’re welcome. :slight_smile:
As of now, the only sane solution is to downgrade to an older Ruby version.
There is an open ticket at the Liquid repository at GitHub for response from the devs there. You can subscribe to it to know if the issue will ever get managed.
In the event Liquid declines to patch it’s 4.x series, Jekyll may have to step in and break some rules for users’ sake.

1 Like

Thank you. After several unsuccessful attempts to downgrade Ruby from 3.2.x → 3.1.x (as suggested "on the internet) I simply copied the contents of the directories /opt/homebrew/ and $HOME/gems/ from my other machine to the “accidentally upgraded” one, and all is fine (for now).
The intrepid Jekyll programmers have my full sympathy!

1 Like

@ashmaroli Could I request you update the Jekyll Installation docs to show how to install the “most-supported” version of Ruby, rather than the latest?

Dear Bill: chruby is one possible answer to this… I gave up on it, possibly too early, but then I had the other option (above).

Agreed that it is one option. I am currently using Ubuntu (in a Docker container), so the instructions have you install the latest version of Jekyll. There is no documentation on how to install a specific version. I have been working on this all day since my Jekyll site is not working at the moment and the documentation from the various sites (rbenv docs, etc) are very much lacking. It is taking so much work to figure this out.

1 Like

Any resolutions/workaround/updates here? A series of forced updates (starting with Xcode tools) caused my Jekyll installation to be updated with the tainted package, and I can’t update my website anymore.

Whoops, just found @ashmaroli’s reply on this GH bug:

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

This workaround lets me use my site, but reading the patch referenced in that reply, it seems like Liquid 4.0.4 should have fixed this, but I encountered it today after running bundle update. So maybe it wasn’t?

Thanks for alerting us! I ran my full update cycle, and got nasty error on running Jekyll

<internal:/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/Users/bach/gems/gems/pathname-0.2.1/lib/pathname.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/ruby/lib/libruby.3.1.dylib (LoadError)
  Referenced from: <DA0087B6-417D-3DED-8A47-9C4B890B177B> /Users/bach/gems/gems/pathname-0.2.1/lib/pathname.bundle … …

So I simply trashed my $HOME/gems folder, ran full update again. All gems installed, it works! Then simply repeat, problems again, now it complained that liquid-4.0.4 was missing. Indeed there was a liquid-5…. So I used bundle install to put liquid-4.0.4 back, but gem cleanup deletes it!

Whatever, my current solution is:

  • Using @ashmaroli 's patch
    gem "jekyll", github: "jekyll/jekyll", ref: "refs/pull/9248/head"
  • making sure liquid-4.0.4 is present (using bundle install)
  • don’t run gem cleanup (???).

Thus Jekyll 4.3.1 runs fine again. Surely a step forward…

Hi there.

I ran into a similar issue when coming back to a Jekyll project after several months. I’m not familiar enough with ruby to understand what the issue was in the first place, but in case it helps anyone, the way I was able to resolve it on my machine (macOS) was to follow the Jekyll install instructions again.

In short

  1. Install chruby and follow the instructions to set things up so the Terminal uses chruby instead of another version of ruby
  2. Install jekyll (even if you had it installed earlier)
  3. Run bundle install in your project
  4. Run bundle exec jekyll serve

No more tainted errors!

I think this was resolved with an update to Liquid (4.0.4), and that would have been addressed when you ran bundle install

In my case, the issue came after running bundle install - but it’s possible there was something else in my config that was causing trouble.

I faced this issue quite recently when I was setting up my new blog. After trying out all the solutions suggested in various places (upgrade Liquid, pin Jekyll to the “fixed” github commit, … and a few others I don’t remember now), I eventually downgraded ruby to 3.1.3 and did a clean install of everything. It solved the problem for me. Not sure if it helps in your case, or you already figured out another solution, but I thought to share it just in case.

sorry to bump an old thread but am at my wit’s end trying to solve this. i updated to liquid 4.0.4 but still have the exact same error.

I wish this website would list THIS SPECIFIC ruby version works with THIS SPECIFIC jekyll version. Sheesh.

I also tried downgrading to a 3.1 version but no dice, other problems cropped up.

I’m really stuck.


ruby 3.2.0
bundler 2.1.4
liquid 4.0.4
jekyll 4.3.2

If it helps any, this is what I am using:

Ruby 3.1.2p20
Bundler 2.4.3
Liquid 4.0.4
Jekyll 4.3.1

Here is my Gemfile:

Note: If you want to use this gemfile, don’t forget to run ‘bundle install’ and then ‘bundle update’ to ensure your gemfile.lock gets the proper updates.

source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "4.3.1"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima", "2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", "~> 1.2"
  gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]

gem "webrick", "~> 1.7"

gem "kramdown-parser-gfm", "~> 1.1"

# By default, Jekyll uses an older SASS converter. Without this line, Jekyll will
# default to DART which will warn about deprecated issues see:
# https://github.com/jekyll/minima/pull/705#issuecomment-1387157504
# Force the use of Jekyll's SASS converter
gem "jekyll-sass-converter", "< 3.0"