Updating to ruby 3: "Error: could not read file" "wrong number of arguments (given 1, expected 0)"

after updating debian to current stable, and so upgrading ruby to 3.1 (from 2.7), i receive the error in the title for all .md and all .org files in my site:

Error: could not read file /path/to/site/markdown-file.md: wrong number of arguments (given 1, expected 0)

i followed the instructions at:

(that is, after upgrading broke, i removed all local+system gems, removed all system ruby, and tried to start over, then followed the reinstall instructions for jekyll.)

i only have a system ruby install, and a local bundler/jeykll/deps install.

earlier, i also tried to force the install of all the old versions of my gems, to see if my site was somehow hitched to them, to no avail.

i have searched for this error and not found anything.

ruby version:

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]

jekyll won’t tell me its version, but i have the latest gems for it and deps.

bundle info jekyll returns: jekyll (4.3.2)

my site runs minimal mistakes, and i have minimal-mistakes-jekyll (4.24.0). (when i run bundle exec jekyll serve i now also receive a number of deprecation warnins about its calling of sass functions (subtraction and so on) but i don’t understand if/how that could cause the issue above?)

has anyone seen this error or might have any tips on how to unbreak my site?

i fixed the deprecation warnings using a fix from the minimal-mistakes repo, downgrading a sass library.

but my site is still broken with the errors regarding all my posts’ .md files.

can you paste the entire output from the console when you run jekyll?

if it literally can’t read a file that is there maybe it is a security issue and something doesn’t have the proper rights?

sure, it looks like so:

Configuration file: /path/to/site/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /path/to/site
       Destination: /path/to/site/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 

 Error: could not read file /path/to/md-files/md-file.md: wrong number of arguments (given 1, expected 0)
[once for every md/org file on my site, in red]

Jekyll Feed: Generating feed for posts
         AutoPages: Disabled/Not configured in site.config.
        Pagination: Complete, processed 1 pagination page(s)
                    done in 1.381 seconds.
 Auto-regeneration: enabled for '/path/to/my/site'
  JekyllAdmin mode: production
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

i had installed my minimal-mistakes theme as a gem, but then later modified it, meaning i copied some of its site/layout files over directly into my site and edited a few layout files. but i’m not sure that could lead to this issue (due to updates conflicts maybe?). to try to get around that, i removed the modified directories, but then it just complained they weren’t there, rather than picking them up from the gem. (i’m unsure if that’s something related or not.)

but also, the error isn’t that it can’t find the file, but that the signature of the function being called has changed: it received 1 arg, expected 0 args.

it’s a pretty unhelpful error that gives a signature error without mentioning the function called.

if i serve with -V enabled, i receive errors like so (1 for each file):

Skipping: Content in _posts/my-post.md is nil

but i’ve checked, and the files are there, and not empty.

would it be plausible to create a new jekyll site, with the same, theme, apply my modifications, and manually copy over my text files?

i’ve just noticed the “about” md page is picked up. it’s in _pages, while things in _posts and other similar custom directories are ignored.

sigh, i fixed it.

it was an old/broken/unmaintained plugin, jekyll-org. one would hope such a plugin wouldn’t also break .md files, but alas thats not how it works, or rather thats not how it breaks.

2 Likes