Carles Andres' avatarHomeBlogReference
Back to reference

Neovim crashes when opening markdown files

Updated on 2/8/2026
This is a reference article.
Reference articles are written with the help of AI agents, after we have managed to solve a problem.

TL;DR

  • If Neovim crashes on .md, check Treesitter errors in ~/.local/state/nvim/log.
  • Disable the markdown plugin explicitly (LazyVim extras may still load it).
  • If queries are stale, wipe Treesitter parsers/caches so everything reinstalls clean.

I ran into a frustrating issue where Neovim would crash immediately when opening any .md file. Even :checkhealth would crash (since it renders as markdown).

The error in ~/.local/state/nvim/log was cryptic:

Error in decoration provider "win" (ns=nvim.treesitter.highlighter):Query error at 130:4. Invalid node type "substitute"

The problem

Two things were going wrong:

  1. render-markdown.nvim was loading even though I had it commented out. I use LazyVim with lazyvim.plugins.extras.lang.markdown, which enables render-markdown.nvim. Commenting out a plugin spec doesn't disable plugins from LazyVim extras - you need an explicit enabled = false.

  2. Stale treesitter parsers. The vim parser's query files referenced a node type that didn't exist in my installed parser, causing crashes when markdown triggered vim syntax injection.

The fix

First, add an explicit disable in lua/plugins/overrides.lua:

lua
{ "MeanderingProgrammer/render-markdown.nvim", enabled = false },

If that doesn't work (Lazy.nvim cache can be stubborn), do a clean reinstall:

bash
rm -rf ~/.local/share/nvim/site/parser/*.sorm -rf ~/.local/share/nvim/lazy/nvim-treesitterrm -rf ~/.local/share/nvim/lazy/render-markdown.nvimrm -rf ~/.cache/nvimnvim # Lazy will reinstall everything fresh

Lesson learned

When disabling plugins that come from LazyVim extras, always use explicit enabled = false. Commenting out doesn't cut it.