zk-org/zk-nvim

"Attempt to index a nil value" after upgrading to `zk` 0.12.0

jfvillablanca opened this issue · 5 comments

Zk seems to work fine yesterday; today I get this error:
Screenshot from 2022-12-09 07-09-57

I did some basic troubleshooting, remove zk-nvim from my plugins lua config, then reinstalled via packer. The error persists.

I followed the traceback to line 50 of ...zk-nvim/lua/zk/commands/init.lua

Screenshot from 2022-12-09 07-12-13

I am not sure if the LSP warning is an indication of the error, I'm not confident enough to troubleshoot Lua.

Neovim version: nightly
I'm not sure if relevant but might as well include additional info:
When I synced my plugins, there was a warning about breaking changes from a recent commit of nvim-treesitter. Unfortunately, I failed to record which commit it was, since I was not expecting an error to start my day.

I will continue to troubleshoot to the best of my ability but I am hoping for someone more knowledgeable to take a look

I noticed that Zk client is attached any time a note is opened.

Screenshot from 2022-12-09 11-26-34

ZkNotes and ZkIndex (or any other command that does not make a New note) works fine. ZkNew commands, however, does not work. Zk detaches from the buffer then all Zk commands would not work.

Screenshot from 2022-12-09 11-29-09

I had the same issue, and for me it was a change in zk

My template was:

# {{env.PROJECT}} {{date now '%Y-%m-%d %H:%M'}}

{{content}}

When running zk new in the shell, it printed zk: the {{date}} template helper was renamed to {{format-date}}, please update your configuration and exited without creating a new file.

I changed it to:

# {{env.PROJECT}} {{format-date now '%Y-%m-%d %H:%M'}}

{{content}}

and now everything is working - zk new in the shell and :ZkNew in nvim

It worked! Unfortunately, the new format prompt does not appear in nvim and I rarely use the shell version to create new notes, so I never encountered the error. 😅

Thanks @eyemyth

Thank you for chiming in @eyemyth. Sorry for that, I didn't think it would fail in a confusing way with zk-nvim.

I'll pin this issue to let folks know.

Thanks for posting this. I was having the same issue and needed to update my templates in order to make it work. A couple more symptoms that I was having that I'll leave here for posterity.

  • Whenever the faulty template was hit, it was killing the lsp server. So I was no longer getting hints on my links nor able to follow links with go to definition.
  • The change also effects filename templates that are included in the config.toml file. i.e. filename = "{{format-date now}}"