ERROR -- : run() in thread failed: Invalid argument @ rb_file_s_lstat


#1

I’ve just started using Jekyll and when I run jekyll serve for a few minutes I keep getting an error and the watcher stops.
I suspect my IDE PHPstorm workspace.xml is being watched and jekyll tries to compile this somehow.

This is the output in my bash Ubuntu on Windows:
Regenerating: 1 file(s) changed at 2017-11-04 14:50:26 …done in 0.4502479 seconds.
E, [2017-11-04T14:50:27.007576 #1995] ERROR – : run() in thread failed: Invalid argument @ rb_file_s_lstat - /mnt/c/jekyll/project/.idea/workspace.xml___jb_old___:\n /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/directory.rb:25:in lstat' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/directory.rb:25:inblock in scan’
/usr/lib/ruby/2.3.0/set.rb:306:in each_key' /usr/lib/ruby/2.3.0/set.rb:306:ineach’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/directory.rb:24:in scan' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/change.rb:56:ininvalidate’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:114:in _queue_change' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:69:in_process_event’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:42:in block (2 levels) in configure' /var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:209:inblock in watch’
/var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/watcher.rb:41:in callback!' /var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/event.rb:128:incallback!’
/var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:243:in block in process' /var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:242:ineach’
/var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:242:in process' /var/lib/gems/2.3.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:225:inrun’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:39:in _run' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:78:inblock in start’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/internals/thread_pool.rb:6:in block in add'\n\ncalled from:\n /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/backend.rb:28:instart’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/listener.rb:67:in block in <class:Listener>' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:ininstance_eval’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in call' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:91:intransition_with_callbacks!’
/var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:57:in transition' /var/lib/gems/2.3.0/gems/listen-3.0.8/lib/listen/listener.rb:90:instart’
/var/lib/gems/2.3.0/gems/jekyll-watch-1.5.0/lib/jekyll/watcher.rb:24:in watch' /var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:94:incall’
/var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:94:in watch' /var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:43:inprocess’
/var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:in block (3 levels) in init_with_program' /var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:ineach’
/var/lib/gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:in block (2 levels) in init_with_program' /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:inblock in execute’
/var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in each' /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:inexecute’
/var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in go' /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:inprogram’
/var/lib/gems/2.3.0/gems/jekyll-3.6.2/exe/jekyll:15:in <top (required)>' /usr/local/bin/jekyll:22:inload’
/usr/local/bin/jekyll:22:in `’


#2

You can tell Jekyll to ignore files using exclude in _config.yml

For example:
exclude: ['README.md', 'Gemfile.lock', 'Gemfile']

Docs:


#3

Thank you using:
exclude: ['README.md', 'Gemfile.lock', 'Gemfile', '.idea', '.gitignore']

solved it for me


#4

I must warn you though, that using

exclude: ['README.md', 'Gemfile.lock', 'Gemfile', '.idea', '.gitignore']

will override the default exclude array, which (since v3.5.0), is:

exclude: ["Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"]

thereby no longer excluding the node_modules and vendor directories which may lead to future issues when your project involves node_modules or the vendor directories…

The recommended way hence is to add the files you need to exclude, to the end of the default exclude array, like so:

exclude:
  - Gemfile
  - Gemfile.lock
  - node_modules
  - vendor/bundle/
  - vendor/cache/
  - vendor/gems/
  - vendor/ruby/
  - README.md
  - .idea
  - .gitignore

Though, till I saw this topic, I was under the impression that all dot-files are automatically ignored by Jekyll.


#5

Thank you Ashmaroli, I was unaware it would override the default exclude array so I’ve changed the exclude array according to your recommendations.

.idea is not a file but a folder hence why it might not ignore it by default.