Neovim 0.12.3 tree-sitter Parser Error on NetBSD

Error in BufReadPost Autocommands for "*":
Lua callback: /usr/pkg/share/nvim/runtime/filetype.lua:28: BufReadPost Autocommands for "*".
.FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /usr/pkg/share/nvim/runtime/ftplugin/markdown.lua: Vim(runtime):E5113: Lua chunk: /usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua:460: Parser could not be created for buffer 1 and language "markdown"

stack traceback:
        [C]: in function 'assert'
        /usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua:460: in function 'start'
        /usr/pkg/share/nvim/runtime/ftplugin/markdown.lua:1: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/pkg/share/nvim/runtime/filetype.lua:28: in function </usr/pkg/share/nvim/runtime/filetype.lua:27>
        [C]: in function 'pcall'
        vim/_core/shared:1648: in function <vim/_core/shared:1628>
        [C]: in function '_with'
        /usr/pkg/share/nvim/runtime/filetype.lua:27: in function </usr/pkg/share/nvim/runtime/filetype.lua:10>

stack traceback:
        [C]: in function '_with'
        /usr/pkg/share/nvim/runtime/filetype.lua:27: in function </usr/pkg/share/nvim/runtime/filetype.lua:10>

The Fix

From within neovim enter this command:

lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000)

To check enter these commands:

:lua print(vim.treesitter.language.add("lua"))
:lua print(vim.treesitter.language.add("markdown"))

From chatGPT

That confirms the real problem: you have no tree-sitter language parsers installed. So Neovim itself is fine, nvim-treesitter is present, but there is no:

lua.so
markdown.so
markdown_inline.so

anywhere under your Neovim data directory.

Inside Neovim, run this exactly:

:lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000)

Then check from the shell:

find ~/.local/share/nvim -type f -path '*/parser/*.so' -print

You should then see something like:

/home/yourname/.local/share/nvim/site/parser/lua.so
/home/yourname/.local/share/nvim/site/parser/markdown.so
/home/yourname/.local/share/nvim/site/parser/markdown_inline.so

After that, restart Neovim and test:

:lua print(vim.treesitter.language.add("lua"))

and

:lua print(vim.treesitter.language.add("markdown"))

Those should return:

true

If the install command throws an error instead of installing the parsers, paste that error. On NetBSD, the next likely issue would be the parser build toolchain or tree-sitter CLI, and we can fix that directly.

Neovim 0.12.3 tree-sitter Parser Error on NetBSD

Problem

When opening Markdown (.md) or Lua files in Neovim on NetBSD, Neovim produced errors such as:

Error in BufReadPost Autocommands

Parser could not be created for buffer 1 and language "markdown"

The traceback pointed into:

/usr/pkg/share/nvim/runtime/ftplugin/markdown.lua
/usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua

Neovim version:

NVIM v0.12.3
Build type: Release
LuaJIT 2.1.1713773202

Initial checks

tree-sitter health showed no obvious problem:

:checkhealth vim.treesitter

However, trying to load the parsers manually showed the problem:

:lua print(vim.treesitter.language.add("lua"))
:lua print(vim.treesitter.language.add("markdown"))

Both returned:

nil

Also, the normal Neovim parser directory did not exist:

/usr/pkg/share/nvim/runtime/parser

Checking for installed parser shared libraries:

find ~/.local/share/nvim -type f -path '*/parser/*.so' -print

returned nothing.

This confirmed that the tree-sitter infrastructure was present, but the actual language parsers were missing.

Neovim plugin configuration

lazy.nvim was already loading:

return {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
        require("config.nvim-treesitter")
    end,
}

There was no need to create an additional treesitter.lua plugin file.

Optionally, the plugin can be loaded eagerly:

return {
    "nvim-treesitter/nvim-treesitter",
    lazy = false,
    build = ":TSUpdate",
    config = function()
        require("config.nvim-treesitter")
    end,
}

The plugin itself being installed does not mean that language parsers are installed.

Solution

From inside Neovim, explicitly install the needed parsers:

:lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000)

This installed the tree-sitter parser shared libraries.

After installation, opening Lua and Markdown files worked normally.

Verification

Check that parser files now exist:

find ~/.local/share/nvim -type f -path '*/parser/*.so' -print

You should see files similar to:

~/.local/share/nvim/site/parser/lua.so
~/.local/share/nvim/site/parser/markdown.so
~/.local/share/nvim/site/parser/markdown_inline.so

You can also verify from within Neovim:

:lua print(vim.treesitter.language.add("lua"))
:lua print(vim.treesitter.language.add("markdown"))

These should now succeed.

Root cause

The nvim-treesitter plugin was installed, but the actual compiled tree-sitter language parsers were not.

In other words:

nvim-treesitter plugin installed
!=
tree-sitter language parsers installed

Neovim attempted to start tree-sitter automatically for Markdown and Lua files, but no parser .so files were available, causing:

Parser could not be created

The fix was to explicitly install the required parsers with:

:lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000)