Liquid Exception: comparison of String with -1 failed in /_layouts/post.html

PLEASE help us help you by writing a good post!

  • kiwi-poet.netlify.app
  • poet.kiwi.
  • 1:04:17 AM: build-image version: 7c55089ca7ee95f1335491e47eb760ebc1408fea (focal)
    1:04:17 AM: buildbot version: 7c55089ca7ee95f1335491e47eb760ebc1408fea
    1:04:17 AM: Fetching cached dependencies
    1:04:17 AM: Failed to fetch cache, continuing with build
    1:04:17 AM: Starting to prepare the repo for build
    1:04:17 AM: No cached dependencies found. Cloning fresh repo
    1:04:17 AM: git clone --filter=blob:none https://github.com/firstfruits/kiwi-poet
    1:04:17 AM: Preparing Git Reference refs/heads/master
    1:04:21 AM: Custom publish path detected. Proceeding with the specified path: ‘_site’
    1:04:21 AM: Custom build command detected. Proceeding with the specified command: ‘./ssg-build.sh’
    1:04:22 AM: Starting to install dependencies
    1:04:23 AM: mise python@3.13.3 install
    1:04:23 AM: mise python@3.13.3 download cpython-3.13.3+20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
    1:04:23 AM: mise python@3.13.3 extract cpython-3.13.3+20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
    1:04:23 AM: mise python@3.13.3 python --version
    1:04:23 AM: mise python@3.13.3 Python 3.13.3
    1:04:23 AM: mise python@3.13.3 ✓ installed
    1:04:23 AM: Python version set to 3.13
    1:04:24 AM: Collecting pipenv
    1:04:25 AM: Downloading pipenv-2025.0.2-py3-none-any.whl.metadata (17 kB)
    1:04:25 AM: Collecting certifi (from pipenv)
    1:04:25 AM: Downloading certifi-2025.4.26-py3-none-any.whl.metadata (2.5 kB)
    1:04:25 AM: Collecting packaging>=22 (from pipenv)
    1:04:25 AM: Downloading packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
    1:04:25 AM: Collecting setuptools>=67 (from pipenv)
    1:04:25 AM: Downloading setuptools-80.4.0-py3-none-any.whl.metadata (6.5 kB)
    1:04:25 AM: Collecting virtualenv>=20.24.2 (from pipenv)
    1:04:25 AM: Downloading virtualenv-20.31.2-py3-none-any.whl.metadata (4.5 kB)
    1:04:25 AM: Collecting distlib<1,>=0.3.7 (from virtualenv>=20.24.2->pipenv)
    1:04:25 AM: Downloading distlib-0.3.9-py2.py3-none-any.whl.metadata (5.2 kB)
    1:04:25 AM: Collecting filelock<4,>=3.12.2 (from virtualenv>=20.24.2->pipenv)
    1:04:25 AM: Downloading filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)
    1:04:25 AM: Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.24.2->pipenv)
    1:04:25 AM: Downloading platformdirs-4.3.8-py3-none-any.whl.metadata (12 kB)
    1:04:25 AM: Downloading pipenv-2025.0.2-py3-none-any.whl (3.0 MB)
    1:04:25 AM: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 51.9 MB/s eta 0:00:00
    1:04:25 AM: Downloading packaging-25.0-py3-none-any.whl (66 kB)
    1:04:25 AM: Downloading setuptools-80.4.0-py3-none-any.whl (1.2 MB)
    1:04:25 AM: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 60.4 MB/s eta 0:00:00
    1:04:25 AM: Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
    1:04:25 AM: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 140.5 MB/s eta 0:00:00
    1:04:25 AM: Downloading certifi-2025.4.26-py3-none-any.whl (159 kB)
    1:04:25 AM: Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
    1:04:25 AM: Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
    1:04:25 AM: Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
    1:04:25 AM: Installing collected packages: distlib, setuptools, platformdirs, packaging, filelock, certifi, virtualenv, pipenv
    1:04:27 AM: Successfully installed certifi-2025.4.26 distlib-0.3.9 filelock-3.18.0 packaging-25.0 pipenv-2025.0.2 platformdirs-4.3.8 setuptools-80.4.0 virtualenv-20.31.2
    1:04:28 AM: [notice] A new release of pip is available: 24.3.1 → 25.1.1
    1:04:28 AM: [notice] To update, run: pip install --upgrade pip
    1:04:28 AM: Attempting Ruby version 2.6.2, read from environment
    1:04:28 AM: Required ruby-2.6.2 is not installed - installing.
    1:04:29 AM: Searching for binary rubies, this might take some time.
    1:04:29 AM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.6.2.tar.bz2
    1:04:29 AM: Checking requirements for ubuntu.
    1:04:29 AM: Requirements installation successful.
    1:04:29 AM: ruby-2.6.2 - #configure
    1:04:29 AM: ruby-2.6.2 - #download
    1:04:29 AM: ruby-2.6.2 - #validate archive
    1:04:32 AM: ruby-2.6.2 - #extract
    1:04:34 AM: ruby-2.6.2 - #validate binary
    1:04:34 AM: ruby-2.6.2 - #setup
    1:04:35 AM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2@global
    1:04:35 AM: ruby-2.6.2 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems…
    1:04:35 AM: ruby-2.6.2 - #generating global wrappers…
    1:04:35 AM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2
    1:04:35 AM: ruby-2.6.2 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
    1:04:35 AM: ruby-2.6.2 - #generating default wrappers…
    1:04:35 AM: Using /opt/buildhome/.rvm/gems/ruby-2.6.2
    1:04:36 AM: Using Ruby version 2.6.2
    1:04:36 AM: Using Bundler version 1.16.6 from Gemfile.lock
    1:04:47 AM: Successfully installed bundler-1.16.6
    1:04:47 AM: 1 gem installed
    1:04:48 AM: Started restoring cached ruby gems
    1:04:48 AM: Finished restoring cached ruby gems
    1:04:48 AM: Installing gem bundle
    1:04:49 AM: Fetching gem metadata from https://rubygems.org/
    1:04:49 AM: Fetching public_suffix 3.0.3
    1:04:49 AM: Installing public_suffix 3.0.3
    1:04:49 AM: Fetching addressable 2.5.2
    1:04:49 AM: Installing addressable 2.5.2
    1:04:49 AM: Using bundler 1.16.6
    1:04:49 AM: Fetching colorator 1.1.0
    1:04:49 AM: Installing colorator 1.1.0
    1:04:49 AM: Fetching concurrent-ruby 1.0.5
    1:04:49 AM: Installing concurrent-ruby 1.0.5
    1:04:49 AM: Fetching eventmachine 1.2.7
    1:04:49 AM: Installing eventmachine 1.2.7 with native extensions
    1:05:00 AM: Fetching http_parser.rb 0.6.0
    1:05:00 AM: Installing http_parser.rb 0.6.0 with native extensions
    1:05:01 AM: Fetching em-websocket 0.5.1
    1:05:01 AM: Installing em-websocket 0.5.1
    1:05:01 AM: Fetching ffi 1.9.25
    1:05:01 AM: Installing ffi 1.9.25 with native extensions
    1:05:06 AM: Fetching forwardable-extended 2.6.0
    1:05:06 AM: Installing forwardable-extended 2.6.0
    1:05:06 AM: Fetching i18n 0.9.5
    1:05:06 AM: Installing i18n 0.9.5
    1:05:06 AM: Fetching rb-fsevent 0.10.3
    1:05:06 AM: Installing rb-fsevent 0.10.3
    1:05:06 AM: Fetching rb-inotify 0.9.10
    1:05:06 AM: Installing rb-inotify 0.9.10
    1:05:06 AM: Fetching sass-listen 4.0.0
    1:05:06 AM: Installing sass-listen 4.0.0
    1:05:06 AM: Fetching sass 3.6.0
    1:05:06 AM: Installing sass 3.6.0
    1:05:07 AM: Fetching jekyll-sass-converter 1.5.2
    1:05:07 AM: Installing jekyll-sass-converter 1.5.2
    1:05:07 AM: Fetching ruby_dep 1.5.0
    1:05:07 AM: Installing ruby_dep 1.5.0
    1:05:07 AM: Fetching listen 3.1.5
    1:05:07 AM: Installing listen 3.1.5
    1:05:07 AM: Fetching jekyll-watch 2.1.2
    1:05:07 AM: Installing jekyll-watch 2.1.2
    1:05:07 AM: Fetching kramdown 1.17.0
    1:05:07 AM: Installing kramdown 1.17.0
    1:05:07 AM: Fetching liquid 4.0.1
    1:05:07 AM: Installing liquid 4.0.1
    1:05:07 AM: Fetching mercenary 0.3.6
    1:05:07 AM: Installing mercenary 0.3.6
    1:05:07 AM: Fetching pathutil 0.16.1
    1:05:07 AM: Installing pathutil 0.16.1
    1:05:07 AM: Fetching rouge 3.3.0
    1:05:07 AM: Installing rouge 3.3.0
    1:05:07 AM: Fetching safe_yaml 1.0.4
    1:05:07 AM: Installing safe_yaml 1.0.4
    1:05:07 AM: Fetching jekyll 3.8.4
    1:05:07 AM: Installing jekyll 3.8.4
    1:05:07 AM: Fetching jekyll-menus 0.6.0
    1:05:07 AM: Installing jekyll-menus 0.6.0
    1:05:07 AM: Fetching jekyll-paginate 1.1.0
    1:05:07 AM: Installing jekyll-paginate 1.1.0
    1:05:07 AM: Fetching jekyll-paginate-v2 1.9.4
    1:05:07 AM: Installing jekyll-paginate-v2 1.9.4
    1:05:07 AM: Bundle complete! 4 Gemfile dependencies, 29 gems now installed.
    1:05:07 AM: Bundled gems are installed into /opt/build/cache/bundle
    1:05:07 AM: Post-install message from sass:
    1:05:07 AM: Ruby Sass is deprecated and will be unmaintained as of 26 March 2019.
    1:05:07 AM: * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
    1:05:07 AM: primary implementation: Sass: Install Sass
    1:05:07 AM: * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
    1:05:07 AM: sassc gem: GitHub - sass/sassc-ruby: Use libsass with Ruby!
    1:05:07 AM: * For more details, please refer to the Sass blog:
    1:05:07 AM: Logdown - Site Maintenance
    1:05:08 AM: Gem bundle installed
    1:05:08 AM: Started restoring cached go cache
    1:05:08 AM: Finished restoring cached go cache
    1:05:08 AM: Installing Go version 1.12 (requested 1.12)
    1:05:12 AM: go version go1.12 linux/amd64
    1:05:13 AM: Using PHP version 8.0
    1:05:14 AM: v22.15.0 is already installed.
    1:05:14 AM: Now using node v22.15.0 (npm v10.9.2)
    1:05:14 AM: Enabling Node.js Corepack
    1:05:14 AM: Started restoring cached build plugins
    1:05:14 AM: Finished restoring cached build plugins
    1:05:15 AM: Successfully installed dependencies
    1:05:15 AM: Starting build script
    1:05:16 AM: Detected 1 framework(s)
    1:05:16 AM: “jekyll” at version “unknown”
    1:05:16 AM: Section completed: initializing
    1:05:17 AM: ​
    1:05:17 AM: Netlify Build
    1:05:17 AM: ────────────────────────────────────────────────────────────────
    1:05:17 AM: ​
    1:05:17 AM: ❯ Version
    1:05:17 AM: @netlify/build 32.1.3
    1:05:17 AM: ​
    1:05:17 AM: ❯ Flags
    1:05:17 AM: accountId: 5aa7e0a57b6ee823d75ea09c
    1:05:17 AM: baseRelDir: false
    1:05:17 AM: buildId: 681f4ed0184a240008317648
    1:05:17 AM: deployId: 681f4ed0184a24000831764a
    1:05:17 AM: ​
    1:05:17 AM: ❯ Current directory
    1:05:17 AM: /opt/build/repo
    1:05:17 AM: ​
    1:05:17 AM: ❯ Config file
    1:05:17 AM: /opt/build/repo/netlify.toml
    1:05:17 AM: ​
    1:05:17 AM: ❯ Context
    1:05:17 AM: production
    1:05:17 AM: ​
    1:05:17 AM: build.command from netlify.toml
    1:05:17 AM: ────────────────────────────────────────────────────────────────
    1:05:17 AM: ​
    1:05:17 AM: $ ./ssg-build.sh
    1:05:18 AM: Configuration file: /opt/build/repo/_config.yml
    1:05:18 AM: Source: /opt/build/repo
    1:05:18 AM: Destination: /opt/build/repo/_site
    1:05:18 AM: Incremental build: disabled. Enable with --incremental
    1:05:18 AM: Generating…
    1:05:18 AM: AutoPages: Disabled/Not configured in site.config.
    1:05:18 AM: Pagination: Disabled in site.config.
    1:05:18 AM: Liquid Exception: comparison of String with -1 failed in /_layouts/post.html
    1:05:18 AM: jekyll 3.8.4 | Error: comparison of String with -1 failed
    1:05:18 AM: ​
    1:05:18 AM: “build.command” failed
    1:05:18 AM: ────────────────────────────────────────────────────────────────
    1:05:18 AM: ​
    1:05:18 AM: Error message
    1:05:18 AM: Command failed with exit code 1: ./ssg-build.sh (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
    1:05:18 AM: ​
    1:05:18 AM: Error location
    1:05:18 AM: In build.command from netlify.toml:
    1:05:18 AM: ./ssg-build.sh
    1:05:18 AM: ​
    1:05:18 AM: Resolved config
    1:05:18 AM: build:
    1:05:18 AM: command: ./ssg-build.sh
    1:05:18 AM: commandOrigin: config
    1:05:18 AM: publish: /opt/build/repo/_site
    1:05:18 AM: publishOrigin: config
    1:05:19 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
    1:05:19 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
    1:05:19 AM: Failing build: Failed to build site
    1:05:19 AM: Finished processing build request in 1m2.231s
  • The Netlify deploy errored. The relevant error log line information is:

Line 0: build-image version: 7c55089ca7ee95f1335491e47eb760ebc1408fea (focal)
Line 1: buildbot version: 7c55089ca7ee95f1335491e47eb760ebc1408fea
Line 2: Fetching cached dependencies
Line 3: Failed to fetch cache, continuing with build
Line 4: Starting to prepare the repo for build
Line 5: No cached dependencies found. Cloning fresh repo
Line 6: git clone --filter=blob:none https://github.com/firstfruits/kiwi-poet
Line 7: Preparing Git Reference refs/heads/master
Line 8: Custom publish path detected. Proceeding with the specified path: ‘_site’
Line 9: Custom build command detected. Proceeding with the specified command: ‘./ssg-build.sh’
Line 10: Starting to install dependencies
Line 11: e[2mmisee[0m e[34mpythone[0m@3.13.3 install
Line 12: e[2mmisee[0m e[34mpythone[0m@3.13.3 download cpython-3.13.3+20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
Line 13: e[2mmisee[0m e[34mpythone[0m@3.13.3 extract cpython-3.13.3+20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
Line 182: e[96me[1m────────────────────────────────────────────────────────────────e[22me[39m
Line 183: ​
Line 184: e[36m$ ./ssg-build.she[39m
Line 185: Configuration file: /opt/build/repo/_config.yml
Line 186: Source: /opt/build/repo
Line 187: Destination: /opt/build/repo/_site
Line 188: Incremental build: disabled. Enable with --incremental
Line 189: Generating…
Line 190: AutoPages: Disabled/Not configured in site.config.
Line 191: Pagination: Disabled in site.config.
Line 192: e[31m Liquid Exception: comparison of String with -1 failed in /_layouts/post.htmle[0m
Line 193: jekyll 3.8.4 | Error: comparison of String with -1 failed
Line 194: e[91me[1m​e[22me[39m
Line 195: e[91me[1m"build.command" failed e[22me[39m
Line 196: e[91me[1m────────────────────────────────────────────────────────────────e[22me[39m
Line 197: ​
Line 198: e[31me[1mError messagee[22me[39m
Line 199: Command failed with exit code 1: ./ssg-build.sh
Line 200: ​
Line 201: e[31me[1mError locatione[22me[39m
Line 202: In build.command from netlify.toml:
Line 203: ./ssg-build.sh
Line 204: ​
Line 205: e[31me[1mResolved confige[22me[39m
Line 206: build:
Line 207: command: ./ssg-build.sh
Line 208: commandOrigin: config
Line 209: publish: /opt/build/repo/_site
Line 210: publishOrigin: config
Line 211: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
Line 212: Build failed due to a user error: Build script returned non-zero exit code: 2
Line 213: Failing build: Failed to build site
Line 214: Finished processing build request in 1m2.231s

Netlify has analyzed the error and provided the following guidance:

Diagnosis:
The build failure is due to an error in the Jekyll build process. It specifically points to a liquid exception in the _layouts/post.html file, causing a comparison of String with -1 to fail (#L192). This error leads to the build script failing with exit code 1 (#L199).

Solution:
To resolve this issue, you need to review the _layouts/post.html file in your repository and correct the comparison operation causing the error within that file.

I have checked my _layouts/post.html files and see no instances where a string is compared with a -1 so am a little stuck.

@firstfruits This issue is beyond the scope of support, as it’s likely to just be a code issue with your project.

A community member may be able to assist, but you would need to provide a link to a public repository.

Thanks Nathan, this website has been running fine for a number of years and the owner has been posting regular poems since 2018. Nothing has been changed on the cms side so I’m thinking there’s been an update or something that has broken the site?

@firstfruits While not an entirely incorrect guess, as it’s not outside of the realm of possibility, it fails to recognize the more likely occurrence, which is that sites connected to CMS’ can break purely due to content changes.

For example, if you have a comparison/loop in a template that is looking at a particular piece of data derived from CMS content, and the client composes or changes content in a way that the template was never coded to anticipate or guard against, then it can break “suddenly and with no code changes”.

Check the logic in the _layouts/post.html file.
Check what data the client recently changed in the CMS.

Did they delete anything drastic (e.g. entire categories of content, or an entry that ‘must exist’)?
Did they create a new entry and fail to tag it with something your site code requires?
etc.

It’s likely to reveal the problem, won’t hurt to investigate, and on the off chance that there is some change on Netlify’s side that has negatively impacted your project you’ll perhaps find that you can provide a reproduction to prove it.