Skip to content

Neorg documents with injected metadata cause lua range error after system update #1699

@jeffgazso

Description

@jeffgazso

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.11.0

Neorg setup

   {
      "nvim-neorg/neorg",
      lazy = false,
      version = "*",
      config = function()
        require("neorg").setup {
          load = {
            ["core.defaults"] = {},
            ["core.concealer"] = {},
            ["core.dirman"] = {
              config = {
                workspaces = {
                  notes = "~/Documents/Neorg",
                },
                default_workspace = "notes",
              },
            },
          },
        }
  
        vim.wo.foldlevel = 99
        vim.wo.conceallevel = 2
      end,
    },
  },
})

Actual behavior

After a system upgrade in which neovim and the treesitter module were updated, Neorg documents containing injected metadata produce Lua callback errors upon saving document. Documents without injected metadata don't seem to have an issue.

Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(), line 1: Vim:Error 
 executing Lua callback: vim/_editor.lua:0: nvim_exec2()[1]..nvim_exec2() called
 at nvim_exec2():1[1]..BufWritePre Autocommands for "*.norg": Vim(append):Error 
executing lua callback: ...eorg/lua/neorg/modules/core/esupports/metagen/module.
lua:245: attempt to call method 'range' (a nil value)        

A lengthy stack trace follows.

Expected behavior

I expect Neorg to be able to modify Neorg documents containing metadata without spawning errors.

Steps to reproduce

  1. From a Gentoo Linux machine, install neovim with # emerge app-editors/neovim
  2. Install Neorg using the kickstart guide in the Neorg wiki.
  3. Install any missing dependencies.
  4. Create a document by opening neovim and then injecting metadata with :Neorg inject-metadata.
  5. Attempt to save the document with :wq. You should see similar errors.

Potentially conflicting plugins

I suspect dev-libs/tree-sitter may have something to do with it. Here are all of the installed tree-sitter libraries and their versions:

dev-libs/tree-sitter-0.25.3
dev-libs/tree-sitter-c-0.23.0
dev-libs/tree-sitter-lua-0.3.0
dev-libs/tree-sitter-markdown-0.4.1
dev-libs/tree-sitter-query-0.5.0
dev-libs/tree-sitter-vim-0.5.0
dev-libs/tree-sitter-vimdoc-3.0.0

Other information

No response

Help

None

Implementation help

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues related to bugs. Please attach a severity, a priority and category with this label.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions