argument error “Option name hard_wrap is already used”

When I try and run bundle exec jekyll serve, I get the error:

  • Conversion error: Jekyll::Converters::Markdown encountered an error while converting. Option name hard_wrap is already used.
  • /.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kramdown-2.3.0/lib/kramdown/options.rb:52:in `define’: Option name hard_wrap is already used (ArgumentError)

I made sure to update to the latest version of Jekyll (4.2.0) and I have kramdown-parser-gfm in my gemfile.

Any help is greatly appreciated.

I don’t think you need to add kramdown-parser-gfm to the Gemfile, because Jekyll automatically includes it as a dependency. You might try removing it, and rebuild Gemfile.lock (i.e. delete it and run bundle install).

Indeed you only need the parser in Gemfile for Jekyll 3.9. Not for 3.8 or 4.x

So you can try remove that from Gemfile, delete project gems and Gemfile.lock and do a clean install.

I am not familiar with rbenv but maybe Kramdown is in that env for a reason outside the current project and that is conflicting?

Also you can try and see if your markdown content is the issue. Like if you delete all your pages or make them blank aside from index.md, do you still get the error.

If you can run jekyll serve --trace can you see which line in your project is causing the error?

Or run with --verbose to see more on what Jekyll is doing at the point the error happens.

I’m running into the same issue with Jekyll 4.3.1 on Ruby 2.7.6p219. I thought the reason was that I’m combining a Nix shell with Jekyll 4.2.0 and a Gemfile.lock with Jekyll 4.3.1, but after forcing Jekyll 4.2.0 via the Gemfile it still runs into the same issue:

$ export CI_DEFAULT_BRANCH=master CI_COMMIT_REF_NAME=refactor/pull-dependencies-into-nix-shell
$ nix-shell --keep CI_COMMIT_REF_NAME --keep CI_DEFAULT_BRANCH --pure --run ./.gitlab/build.bash
Configuration file: /home/victor/dev/victor-engmark.gitlab.io/_config.yml
            Source: /home/victor/dev/victor-engmark.gitlab.io
       Destination: /home/victor/dev/victor-engmark.gitlab.io/public/refactor/pull-dependencies-into-nix-shell
 Incremental build: disabled. Enable with --incremental
      Generating... 
[jekyll-webmention_io] Beginning to gather webmentions of your posts. This may take a while. 
                    ------------------------------------------------
      Jekyll 4.2.0   Please append `--trace` to the `build` command 
                     for any additional information or backtrace. 
                    ------------------------------------------------
Traceback (most recent call last):
	44: from /nix/store/m47wpmiw6hxvnbm1zk4ickpjmqnlv3ca-blog/bin/jekyll:21:in `<main>'
	43: from /nix/store/m47wpmiw6hxvnbm1zk4ickpjmqnlv3ca-blog/bin/jekyll:21:in `load'
	42: from /nix/store/m47wpmiw6hxvnbm1zk4ickpjmqnlv3ca-blog/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
	41: from /nix/store/2x46d01ckqxfxliawfnbb3avhhw2kx80-ruby2.7.6-mercenary-0.3.6/lib/ruby/gems/2.7.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	40: from /nix/store/2x46d01ckqxfxliawfnbb3avhhw2kx80-ruby2.7.6-mercenary-0.3.6/lib/ruby/gems/2.7.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	39: from /nix/store/2x46d01ckqxfxliawfnbb3avhhw2kx80-ruby2.7.6-mercenary-0.3.6/lib/ruby/gems/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	38: from /nix/store/2x46d01ckqxfxliawfnbb3avhhw2kx80-ruby2.7.6-mercenary-0.3.6/lib/ruby/gems/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	37: from /nix/store/2x46d01ckqxfxliawfnbb3avhhw2kx80-ruby2.7.6-mercenary-0.3.6/lib/ruby/gems/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	36: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	35: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	34: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
	33: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	32: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
	31: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
	30: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
	29: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:79:in `process'
	28: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:191:in `generate'
	27: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:191:in `each'
	26: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:193:in `block in generate'
	25: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:51:in `generate'
	24: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:51:in `each'
	23: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:52:in `block in generate'
	22: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:98:in `check_for_webmentions'
	21: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:157:in `cache_new_webmentions'
	20: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:157:in `reverse_each'
	19: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/generators/gather_webmentions.rb:166:in `block in cache_new_webmentions'
	18: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/webmention_io/webmention_item.rb:26:in `to_hash'
	17: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/webmention_io/webmention_item.rb:50:in `gather_content'
	16: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/webmention_io/webmention_item.rb:173:in `determine_content'
	15: from /nix/store/7kx6pw1kdg7mcq88pxinmlnqqmaac616-ruby2.7.6-jekyll-webmention_io-3.3.6/lib/ruby/gems/2.7.0/gems/jekyll-webmention_io-3.3.6/lib/jekyll/webmention_io/webmention_item.rb:57:in `markdownify'
	14: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:84:in `convert'
	13: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:15:in `setup'
	12: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:37:in `get_processor'
	11: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:37:in `new'
	10: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown/kramdown_parser.rb:89:in `initialize'
	 9: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown/kramdown_parser.rb:122:in `load_dependencies'
	 8: from /nix/store/4b7sws683fh091psgc0nrq651yzz22dx-ruby2.7.6-jekyll-4.2.0/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/converters/markdown/kramdown_parser.rb:122:in `require'
	 7: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown-parser-gfm.rb:10:in `<top (required)>'
	 6: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown-parser-gfm.rb:10:in `require_relative'
	 5: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm.rb:13:in `<top (required)>'
	 4: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm.rb:13:in `require_relative'
	 3: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:10:in `<top (required)>'
	 2: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:11:in `<module:Kramdown>'
	 1: from /nix/store/fglx808jywp48hah5wzww7h13zays0gi-ruby2.7.6-kramdown-parser-gfm-1.1.0/lib/ruby/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm/options.rb:13:in `<module:Options>'
/nix/store/kpv1fiylf5m2ybzqsdrn6dq7d2ajaqhy-ruby2.7.6-kramdown-1.11.1/lib/ruby/gems/2.7.0/gems/kramdown-1.11.1/lib/kramdown/options.rb:52:in `define': Option name hard_wrap is already used (ArgumentError)

An error code have been modified on the _config.yml
Double check every line on config to see.

Not sure what you mean. _config.yml did not change in this branch.

normally when I see error logs like that the paths are all the same - but you have a bunch of different ones inside the nix/store directory.

Normally that means there is more than one ruby installation and that causes issues.

I’d try uninstalling ruby and re-installing it, but I am not very familiar with nix systems so maybe that is normal but my guess is it is not.

I’m sorry, I never had experience with Nix shell with jekyll before.