orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

opt: expected table, got string

Open fleimgruber opened this issue 3 months ago • 12 comments

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_grammar to 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

fleimgruber avatar Sep 08 '25 09:09 fleimgruber

Few issues:

  1. Minimal Neovim version required is 0.11, you are running 0.10.3
  2. 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.

kristijanhusak avatar Sep 08 '25 10:09 kristijanhusak

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?

fleimgruber avatar Sep 08 '25 12:09 fleimgruber

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.

kristijanhusak avatar Sep 08 '25 13:09 kristijanhusak

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>

fleimgruber avatar Sep 08 '25 13:09 fleimgruber

This stackstrace does not mention anything related to orgmode. It is caused by another plugin, from what I see, render-markdown.nvim.

kristijanhusak avatar Sep 08 '25 13:09 kristijanhusak

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?

fleimgruber avatar Sep 08 '25 13:09 fleimgruber

Does your org file have a block src that is markdown? Also, can you try opening some random markdown file?

kristijanhusak avatar Sep 08 '25 13:09 kristijanhusak

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.

fleimgruber avatar Sep 08 '25 13:09 fleimgruber

Can you try with the minimal init provided in the repo and see if the file loads correctly?

kristijanhusak avatar Sep 08 '25 13:09 kristijanhusak

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.

fleimgruber avatar Sep 23 '25 14:09 fleimgruber

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, },

aaharr avatar Oct 12 '25 16:10 aaharr

Just a reminder that latest master and latest version requires neovim 0.11+.

kristijanhusak avatar Oct 12 '25 18:10 kristijanhusak