opt: expected table, got string
Describe the bug
I used the config from README.md (https://github.com/nvim-orgmode/orgmode/blob/a49d5d4c479cbf70acf261c1e8f1f69947ed1b81/README.org#installation)
and got the error:
Failed to run `config` for orgmode
...a/lazy/orgmode/lua/orgmode/config/mappings/map_entry.lua:53: opt: expected table, got string
# stacktrace:
- vim\shared.lua:936 _in_ **validate**
- orgmode\lua\orgmode\config\mappings\map_entry.lua:53 _in_ **action**
- orgmode\lua\orgmode\config\mappings\init.lua:5
- orgmode\lua\orgmode\config\init.lua:6
- orgmode\lua\orgmode\init.lua:122 _in_ **setup**
- AppData/Local/nvim/lua/plugins/lazy.lua:10 _in_ **config**
- scoop/apps/neovim/current/share/nvim/runtime/filetype.lua:36
- scoop/apps/neovim/current/share/nvim/runtime/filetype.lua:35
checkhealth
orgmode: require("orgmode.health").check()
Orgmode ~
- ERROR Treesitter grammar is not installed. Run
:Org install_treesitter_grammarto install it. - ERROR Failed to run healthcheck for "orgmode" plugin. Exception: ...Data/Local/nvim-data/lazy/orgmode/lua/orgmode/health.lua:55: loop or previous error loading module 'orgmode.config'
Steps to reproduce
Use the default config from README.md and open an .org file.
Expected behavior
orgmode starts without error.
Emacs functionality
No response
Minimal init.lua
-- Enter your minimal_init.lua here
Screenshots and recordings
No response
nvim-orgmode version
a49d5d4
OS / Distro
Windows 10
Neovim version/commit
NVIM v0.10.3 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info
Additional context
No response
Few issues:
- Minimal Neovim version required is 0.11, you are running 0.10.3
- You are missing the treesitter grammar, as checkhealth returned. Try removing everything from the setup call (just to
require('orgmode').setup(), restart, and see if it works then. If there is no message that grammar is installed, install it with the command that checkhealth prints.
Thanks for checking back so quickly.
Acknowledged, and I will fix those issues, but how are they related to the error? I am not familiar with the error handling, but the root cause of the error should be reported to the users for them to be able to fix those causes?
Updating to Neovim 0.11 should give you a better error message. Internal validation depends on newer neovim version since the interface changed between 0.10 and 0.11. Try updating and let me know if you run into any issues.
Fixed the issues (i.e. installed neovim 0.11.4), but getting (with and without the treesitter ignore_install = { 'org' } setting):
3:01:31 PM msg_show Error executing vim.schedule lua callback: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 1:3. Invalid node type "comment":
((comment) @injection.content
^
stack traceback:
[C]: in function '_ts_parse_query'
.../current/share/nvim/runtime/lua/vim/treesitter/query.lua:373: in function 'fn'
...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'fn'
...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'get'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:142: in function 'new'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:670: in function 'add_child'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:440: in function 'f'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:208: in function 'tcall'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:624: in function '_parse'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:572: in function 'parse'
...ender-markdown.nvim/lua/render-markdown/request/view.lua:62: in function 'parse'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:169: in function 'parse'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:142: in function 'render'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:125: in function 'run'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:91: in function <...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:90>
Error 3:01:31 PM msg_show.lua_error Error executing vim.schedule lua callback: ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:208: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 1:3. Invalid node type "comment":
((comment) @injection.content
^
stack traceback:
[C]: in function 'f'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:208: in function 'tcall'
...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:530: in function <...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:513>
[C]: in function 'wait'
...ppData/Local/nvim-data/lazy/lazy.nvim/lua/lazy/async.lua:113: in function 'wait'
...cal/nvim-data/lazy/lazy.nvim/lua/lazy/manage/process.lua:235: in function <...cal/nvim-data/lazy/lazy.nvim/lua/lazy/manage/process.lua:232>
[C]: in function 'pcall'
...a/Local/nvim-data/lazy/lazy.nvim/lua/lazy/manage/git.lua:192: in function 'get_tag_refs'
...a/Local/nvim-data/lazy/lazy.nvim/lua/lazy/manage/git.lua:161: in function 'ref'
...a/Local/nvim-data/lazy/lazy.nvim/lua/lazy/manage/git.lua:149: in function <...a/Local/nvim-data/lazy/lazy.nvim/lua/lazy/manage/git.lua:118>
[C]: in function 'pcall'
...cal/nvim-data/lazy/lazy.nvim/lua/lazy/manage/checker.lua:43: in function 'fast_check'
...cal/nvim-data/lazy/lazy.nvim/lua/lazy/manage/checker.lua:15: in function 'start'
.../Local/nvim-data/lazy/lazy.nvim/lua/lazy/core/config.lua:345: in function 'fn'
vim/_editor.lua:615: in function 'fn'
vim/_editor.lua:366: in function <vim/_editor.lua:365>
This stackstrace does not mention anything related to orgmode. It is caused by another plugin, from what I see, render-markdown.nvim.
Thanks, I did not read that carefully. Hm, a :checkhealth render-markdown does not show an issue. Also, this error only appears when opening .org files?
Does your org file have a block src that is markdown? Also, can you try opening some random markdown file?
Random markdown file works without error.
Correction: Error only shows with the file I originally tested with, not with 1-3 other random .org files. The file that shows the error does not have a markdown src block.
Can you try with the minimal init provided in the repo and see if the file loads correctly?
I am new to neovim, lazy and lua so I don't immediately see a way to do this. I just followed the installation instructions in the README. Maybe put a section on minimal init usage in the README? I can see scripts/minimal_init.lua, but no docs on where the default(?) init is changed.
Future self: Updating lazyvim and nvim did seem to fix this issue. Just use whatever nvim version the latest lazyvim requires!
Edit: Turns out "eventually" was like 30 minutes later. Leaving up in case someone nees to see just this!
I am also facing this issue, just on startup, opening a blank .org file.
Maybe someone familiar with map_entry.lua could take a look.
Also on nvim 10.4 (lazyvim), but it looks like upgrading didn't fix it for op. I'd rather not do that or crawl through every plugin when they all place nice together, but nvim-orgmode does not.
Eventually I will get around to doing that, but I figured it's a useful datapoint, and it might be worth documenting. (I'm not at all expecting you'll be able to properly diagnose from this, just for reference)
{ "nvim-orgmode/orgmode", ft = { "org" }, dependencies = { "nvim-treesitter/nvim-treesitter" }, enabled = true, config = function() require("orgmode").setup({}) end, },
Just a reminder that latest master and latest version requires neovim 0.11+.