Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup Error "List or Blob required" #2188

Closed
ryleelyman opened this issue Oct 1, 2021 · 28 comments
Closed

Startup Error "List or Blob required" #2188

ryleelyman opened this issue Oct 1, 2021 · 28 comments
Labels

Comments

@ryleelyman
Copy link

Description

When opening a LaTeX file in a project I get the following error:
Screen Shot 2021-10-01 at 11 45 41 AM

After this it appears that VimTeX fails to load; expected commands like gf, \ll and others do not work, and :VimtexInfo returns "Not an editor command".

Steps to reproduce

Minimal test file:

vim.g.maplocallleader = '\\'
vim.cmd 'packadd packer.nvim'

return require('packer').startup(function(use)
	use 'lervag/vimtex'
end)

Minimal test tex file: (opening test.tex as a new file works fine. After writing this and invoking :e preamble.tex I get the error above.)

\documentclass{article}
\input{preamble}

\begin{document}
\input{content}
\end{document}

Expected behavior

Vimtex to load

Actual behavior

The error mentioned above:
Screen Shot 2021-10-01 at 11 45 41 AM

Do you use a latexmkrc file?

No

VimtexInfo

This is what I get when running `:VimtexInfo` on the above file after saving it.
I also get a similar error to the one described above.

System info
  OS: macOS 11.5.2 (20G95)
  Vim version: NVIM v0.6.0-dev+368-g9337fff8a
  Has clientserver: true
  Servername: /var/folders/2y/hwll5x9j6271lr30klvck8f80000gn/T/nvimmPPTRh/0

If I instead run :VimtexInfo on a completely blank TeX document I get

System info
  OS: macOS 11.5.2 (20G95)
  Vim version: NVIM v0.6.0-dev+368-g9337fff8a
  Has clientserver: true
  Servername: /var/folders/2y/hwll5x9j6271lr30klvck8f80000gn/T/nvimmPPTRh/0

VimTeX project: test2
  base: test2.tex
  root: /Users/rylee/.config/nvim
  tex: /Users/rylee/.config/nvim/test2.tex
  main parser: current file
  document class: 
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
@ryleelyman ryleelyman added the bug label Oct 1, 2021
@clason
Copy link
Contributor

clason commented Oct 1, 2021

I cannot reproduce this (same Neovim version on macOS). Make sure you don't have stale packages lying around (set packpath= in your init.vim and add vimtex to rtp directly as in the issue template).

Also, how did you install Neovim?

@ryleelyman
Copy link
Author

brew install --HEAD. I'll try that suggestion now

@clason
Copy link
Contributor

clason commented Oct 1, 2021

Can you try building directly from the repo?

@ryleelyman
Copy link
Author

sure, I can try that. It started breaking on an earlier version of neovim after I did :PackerSync.

@clason
Copy link
Contributor

clason commented Oct 1, 2021

yeah, there were some vim patches related to blobs that got ported recently, but I wouldn't expect such breakage.

@ryleelyman
Copy link
Author

I built neovim from source, and now I get the same error with the following init.vim:

set nocompatible
set packpath=
let &runtimepath  = '~/.local/share/nvim/site/pack/packer/start/vimtex,' . &runtimepath
let &runtimepath .= ',~/.local/share/nvim/site/pack/packer/start/vimtex/after'
filetype plugin indent on
syntax enable

@clason
Copy link
Contributor

clason commented Oct 1, 2021

Hmm, that's the same I do. Maybe I'm not following the steps exactly. Could you make them more explicit ("step 1, step 2, step 3... crash?")

(Step 1 should be nvim --clean -u init.vim ...)

@ryleelyman
Copy link
Author

ryleelyman commented Oct 1, 2021

Step 1: nvim --clean -u ~/.config/nvim/minit.vim (that's what I've called it)
Step 2: :e test.tex
Step 3: Type in

\documentclass{article}
\input{preamble.tex}
\begin{document}
arst
\end{document}

Step 4: :w, :e preamble.tex gives the crash.

ETA: I tried (in my normal neovim setup) removing and reinstalling vimtex with Packer, but the problem persists.

@clason
Copy link
Contributor

clason commented Oct 1, 2021

Nope, sorry, can't reproduce. Do I actually need to type it (because I just copy&paste, because I'm lazy...)

@ryleelyman
Copy link
Author

Surely you shouldn't need to type it.

@ryleelyman
Copy link
Author

ryleelyman commented Oct 1, 2021

Doing commit = "fbe94cd3eaed89d6c1236af486466b1fcc3b82c9" in Packer fixes the issue for me, but any newer and I still get the error. So for me the problem commit is 507924a

lervag added a commit that referenced this issue Oct 1, 2021
Provide more helpful error message on invalid cache state.

refer: #2188
@lervag
Copy link
Owner

lervag commented Oct 1, 2021

So, first: Sorry for this. I recently made some changes to the kpsewhich caching which makes old cache files invalid. I documented it in the commit log and was planning to announce this in the next release. However, I now see that it is better to give a proper and helpful error message.

Please update, and if required, run :VimtexClearCache kpsewhich.

@lervag lervag closed this as completed Oct 1, 2021
@ryleelyman
Copy link
Author

The plugin now does load and functions fine, but I get asked to run :VimtexClearCache kpsewhich essentially in all situations where previously there was an error. Running the command does fix the issue each time. Should I expect this business of needing to run the command a lot to sort itself out over time?

@lervag
Copy link
Owner

lervag commented Oct 2, 2021

The plugin now does load and functions fine, but I get asked to run :VimtexClearCache kpsewhich essentially in all situations where previously there was an error. Running the command does fix the issue each time. Should I expect this business of needing to run the command a lot to sort itself out over time?

No, this is very unexpected. I'm sorry for the invonvenience!

So, how to debug this... It could be helpful to see the content of your cache file. It should live at ~/.cache/vimtex/kpsewhich.json; I believe this is the same for MacOS as on Linux. Could you copy the file (or some of it, if it is very long) here?

Perhaps there's a minor bug I'm unaware of. So another alternative is that you make a fully minimal example. If you can make a reproducible sample, then I should be able to fix it.

@lervag lervag reopened this Oct 2, 2021
@ryleelyman
Copy link
Author

I actually don't have a file at ~/.cache/vimtex/kpsewhich.json!

@ryleelyman
Copy link
Author

oh you know what, this is because I use TinyTeX rather than TeXLive. I did tlmgr search --global kpsewhich which gave me the ltxfileinfo package as a result. Installing that with tlmgr install ltxfileinfo and then running fmtutil-sys -all seems to have solved the issue for me.

@ryleelyman
Copy link
Author

ryleelyman commented Oct 2, 2021

Sorry, I spoke too soon; the errors are still cropping up. It is odd that there is no file at ~/.cache/vimtex/kpsewhich.json

@ryleelyman ryleelyman reopened this Oct 2, 2021
@lervag
Copy link
Owner

lervag commented Oct 2, 2021

Yes, very odd indeed!

Can you try your original minimal example again, but this time add let g:vimtex_cache_root = '.' to the test.vim file? Does it work now, when you follow the outlined steps? Does this create the kpsewhich.json file?

Could you run nvim --headless -u test.vim with this test.vim and show me the output?

set nocompatible
" NB: Use the proper path here - I may have been mistaken!
set runtimepath^=~/.local/share/nvim/site/pack/packer/start/vimtex
filetype plugin on

setfiletype tex

let s:cache = vimtex#cache#open('kpsewhich')
unsilent echo s:cache
quitall

@ryleelyman
Copy link
Author

ryleelyman commented Oct 2, 2021

here's that output (with newlines added)

{'has': function('39'), 
'read': function('42'), 
'data': {}, 
'clear': function('43'), 
'name': 'kpsewhich', 
'persistent': 1, 
'set': function('40'), 
'modified': 0, 
'local': 0, 
'write': function('41'), 
'get': function('38'), 
'ftime': -1, 
'path': '/Users/rylee/.cache/vimtex/kpsewhich.json'}% 

@ryleelyman
Copy link
Author

ryleelyman commented Oct 2, 2021

When I add let g:vimtex_cache_root = '.' to the minimal .vim file, not only does it run without errors, there is a kspewhich.json file created (in my root directory), whose contents are:

{"preamble.tex": [["", "/Users/rylee"]]}

This is after the following steps:

  • nvim --clean -u ~/.config/nvim/minit.vim
  • :e test.tex
  • type
\documentclass{article}
\input{preamble.tex}
\begin{document}
[...]
\end{document}
  • :w, I tried gf on preamble.tex and neovim stopped responding until I did <C-c> (Presumably there are lots of files in my root directory to check whether there exists preamble.tex)
  • :e preamble.tex, write some stuff and save.

@ryleelyman
Copy link
Author

In case it's useful, ~/.cache/vimtex/ has plenty of .json files in it of the form bibcomplete%path%to%paper%main.json or bibfiles%..., refcomplete%... and one called pkgcomplete.json, just no kpsewhich.json.

@ryleelyman
Copy link
Author

I got a little ambitious and just put g:vimtex_cache_root = '/Users/rylee/.cache/vimtex' in my ~/.config/nvim/plugin/vimtex.vim file and so far I haven't been asked to do :VimtexClearCache kpsewhich in situations where I otherwise have been today.

@lervag
Copy link
Owner

lervag commented Oct 3, 2021

I got a little ambitious and just put g:vimtex_cache_root = '/Users/rylee/.cache/vimtex' in my ~/.config/nvim/plugin/vimtex.vim file and so far I haven't been asked to do :VimtexClearCache kpsewhich in situations where I otherwise have been today.

Interesting. Does the file exist now?

@lervag
Copy link
Owner

lervag commented Oct 3, 2021

I have to admit this issue annoys me, because as far as I can see, everything should work; you should not need to set the g:vimtex_cache_root yourself, especially if you use the default value. And I get annoyed when I don't understand things... :p

@ryleelyman
Copy link
Author

Yeah, now it has content like the following

{"./figures/#1.pdf_tex": [["", "/Users/rylee"], ["", "/Users/rylee/Research/Papers/TrainTracksonGraphsofGroups"], ["", "/Users/rylee/Dropbox/Research/Papers/TrainTracksonGraphsofGroups"], ["", "/Users/rylee/Research/Papers/SimplyConnectedatInfinity"]]}

@lervag
Copy link
Owner

lervag commented Oct 3, 2021

Great, that looks quite right. What happens if you comment out let g:vimtex_cache_root ... now? Does it stop working?

@ryleelyman
Copy link
Author

It seems to still work!

@lervag
Copy link
Owner

lervag commented Oct 4, 2021

Great. I'll close the issue, then, even thought I still don't understand everything... :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants