nvim-treesitter / nvim-treesitter

Nvim Treesitter configurations and abstraction layer
Apache License 2.0
10.34k stars 869 forks source link

installed parsers can fail randomly with "uv_dlopen: no error" #6764

Closed kennethnym closed 2 months ago

kennethnym commented 2 months ago

Describe the bug

about a week ago, my syntax highlighting for every language (go, json, ts, dockerfile, etc.) randomly went away. i suspected it might be due to plugin updates (even though since the last time i updated plugins syntax highlighting was working just fine for about a week), so i nuked my whole nvim setup (including uninstalling the binary) and installed everything from scratch again. treesitter highlighting worked fine for a while, until all of a sudden "uv_dlopen: no error" started to appear for a random parser, then it would start propagating to other parsers as well. right now, some parsers work, and some don't

i tried to reinstall everything multiple times, but i have not been able to track down what specific parser is causing this error.

what i have attempted to debug the issue:

neither using stable nvim nor master nvim fixed the issue

To Reproduce

  1. install nvim (either via brew or compiling from source)
  2. install Lazy package manager
  3. install nvim-treesitter through Lazy
  4. open any file to trigger a parser install
  5. use neovim as normal
  6. parsers start to fail randomly
  7. syntax highlighting is lost for languages with failing parsers upon restart

Expected behavior

no error message and syntax highlighting works normally

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.22.6 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.11.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: Apple clang version 15.0.0 (clang-1500.3.9.4)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "arm64",
  release = "23.4.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - dockerfile          x . . . x
  - go                  ✓ ✓ ✓ ✓ ✓
  - json                x x x x .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            x . x x x
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - sql                 ✓ . . ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR dockerfile(highlights): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'dockerfile': uv_dlopen: no error
  dockerfile(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/dockerfile/highlights.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'dockerfile': uv_dlopen: no error
- ERROR dockerfile(injections): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'dockerfile': uv_dlopen: no error
  dockerfile(injections) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/dockerfile/injections.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'dockerfile': uv_dlopen: no error
- ERROR json(highlights): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
  json(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/json/highlights.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
- ERROR json(locals): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
  json(locals) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/json/locals.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
- ERROR json(folds): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
  json(folds) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/json/folds.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
- ERROR json(indents): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
  json(indents) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/json/indents.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'json': uv_dlopen: no error
- ERROR markdown(highlights): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/highlights.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(folds): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(folds) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/folds.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(indents): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(indents) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/indents.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(injections): ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(injections) is concatenated from the following files:
  | [ERROR]:"/Users/kenneth/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/injections.scm", failed to load: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error

### Output of `nvim --version`

```text
NVIM v0.11.0-dev-230+g0231265c8
Build type: RelWithDebInfo
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info


### Additional context

macOS version: 14.4.1
nickdichev-firework commented 2 months ago

I am having the same problem on neovim 0.10, macos 13.2, here's my checkhealth:

nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v14.19.3 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `clang` executable found. Selected from { "clang", "cc", "gcc", "clang", "cl", "zig" }
  Version: clang version 16.0.6
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "arm64",
  release = "22.3.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 22.3.0: Thu Jan  5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - elixir              ✓ ✓ ✓ ✓ ✓
  - erlang              ✓ . ✓ . .
  - hcl                 ✓ . ✓ ✓ ✓
  - heex                ✓ ✓ ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - jsonnet             ✓ ✓ ✓ . .
  - julia               ✓ ✓ ✓ ✓ ✓
  - just                ✓ ✓ ✓ ✓ ✓
  - kconfig             ✓ ✓ ✓ ✓ ✓
  - kdl                 ✓ ✓ ✓ ✓ ✓
  - kotlin              ✓ ✓ ✓ . ✓
  - koto                ✓ ✓ ✓ . ✓
  - lua                 x x x x x
  - markdown            x . x x x
  - markdown_inline     ✓ . . . ✓
  - nix                 x x x . x
  - python              x x x x x
  - query               ✓ ✓ ✓ ✓ ✓
  - toml                x x x x x
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              x . . . ✓
  - yaml                x x x x x

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR lua(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/lua/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/dracula.nvim/after/queries/lua/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(locals): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(locals) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/lua/locals.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/lua/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(indents): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(indents) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/lua/indents.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/lua/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR markdown(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/dracula.nvim/after/queries/markdown/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(indents): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(indents) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/indents.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR markdown(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
  markdown(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/markdown/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'markdown': uv_dlopen: no error
- ERROR nix(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
  nix(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/nix/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
- ERROR nix(locals): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
  nix(locals) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/nix/locals.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
- ERROR nix(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
  nix(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/nix/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
- ERROR nix(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
  nix(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/nix/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'nix': uv_dlopen: no error
- ERROR python(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
  python(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/python/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
- ERROR python(locals): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
  python(locals) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/python/locals.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
- ERROR python(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
  python(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/python/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
- ERROR python(indents): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
  python(indents) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/python/indents.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
- ERROR python(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
  python(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/python/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'python': uv_dlopen: no error
- ERROR toml(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
  toml(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/toml/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
- ERROR toml(locals): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
  toml(locals) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/toml/locals.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
- ERROR toml(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
  toml(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/toml/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
- ERROR toml(indents): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
  toml(indents) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/toml/indents.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
- ERROR toml(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
  toml(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/toml/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'toml': uv_dlopen: no error
- ERROR vimdoc(highlights): ...d-0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 2:4. Invalid node type "delimiter":
    (delimiter) @markup.heading.1
     ^

  vimdoc(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/vimdoc/highlights.scm", failed to load: ...d-0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 2:4. Invalid node type "delimiter":
    (delimiter) @markup.heading.1
     ^

- ERROR yaml(highlights): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
  yaml(highlights) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/yaml/highlights.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
- ERROR yaml(locals): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
  yaml(locals) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/yaml/locals.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
- ERROR yaml(folds): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
  yaml(folds) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/yaml/folds.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
- ERROR yaml(indents): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
  yaml(indents) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/yaml/indents.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
- ERROR yaml(injections): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
  yaml(injections) is concatenated from the following files:
  | [ERROR]:"/Users/firework/.local/share/nvim/lazy/nvim-treesitter/queries/yaml/injections.scm", failed to load: ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'yaml': uv_dlopen: no error
clason commented 2 months ago

This is almost certainly a compiler issue. However, the compiler reported in checkhealth looks correct (as in, not a known problematic version like ancient gcc or clang 16).

Can you

  1. make sure that the parsers are actually compiled with this compiler? (If you want to go the extra mile, clone a random parser repo and compile manually.)
  2. reinstall your Apple developer tools (do you have Xcode installed, or just the Command Line Tools)?
kennethnym commented 2 months ago

afaik cc, gcc, clang and the likes are symlinked to apple clang, so it is definitely picking up the correct compiler as there is only one compiler.

i also went ahead and maked tree-sitter-typescript. here is the output:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C typescript all
cc -Isrc -std=c11 -fPIC   -c -o src/parser.o src/parser.c
cc -Isrc -std=c11 -fPIC   -c -o src/scanner.o src/scanner.c
ar rv libtree-sitter-typescript.a src/parser.o src/scanner.o
ar: creating archive libtree-sitter-typescript.a
a - src/parser.o
a - src/scanner.o
cc  -dynamiclib -Wl,-install_name,/usr/local/lib/libtree-sitter-typescript.0.dylib,-rpath,@executable_path/../Frameworks src/parser.o src/scanner.o  -o libtree-sitter-typescript.dylib
sed  -e 's|@URL@|https://github.com/tree-sitter/tree-sitter-typescript|' \
                -e 's|@VERSION@|0.21.1|' \
                -e 's|@LIBDIR@|/usr/local/lib|' \
                -e 's|@INCLUDEDIR@|/usr/local/include|' \
                -e 's|@REQUIRES@||' \
                -e 's|@ADDITIONAL_LIBS@||' \
                -e 's|=/usr/local|=${prefix}|' \
                -e 's|@PREFIX@|/usr/local|' ../bindings/c/tree-sitter-typescript.pc.in > tree-sitter-typescript.pc
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tsx all
cc -Isrc -std=c11 -fPIC   -c -o src/parser.o src/parser.c
cc -Isrc -std=c11 -fPIC   -c -o src/scanner.o src/scanner.c
ar rv libtree-sitter-tsx.a src/parser.o src/scanner.o
ar: creating archive libtree-sitter-tsx.a
a - src/parser.o
a - src/scanner.o
cc  -dynamiclib -Wl,-install_name,/usr/local/lib/libtree-sitter-tsx.0.dylib,-rpath,@executable_path/../Frameworks src/parser.o src/scanner.o  -o libtree-sitter-tsx.dylib
sed  -e 's|@URL@|https://github.com/tree-sitter/tree-sitter-typescript|' \
                -e 's|@VERSION@|0.21.1|' \
                -e 's|@LIBDIR@|/usr/local/lib|' \
                -e 's|@INCLUDEDIR@|/usr/local/include|' \
                -e 's|@REQUIRES@||' \
                -e 's|@ADDITIONAL_LIBS@||' \
                -e 's|=/usr/local|=${prefix}|' \
                -e 's|@PREFIX@|/usr/local|' ../bindings/c/tree-sitter-tsx.pc.in > tree-sitter-tsx.pc

it seems like it is using cc as the compiler, which is what was reported in :checkhealth.

to address your second point, i have xcode 15.3 installed.

clason commented 2 months ago

Well, there could be more than one compiler installed even if they're all Apple's.

Can you download the command line tools and switch to those, just to test? (And you should build a typescript.so so you can test it with Neovim; probably the lua parser would be easier for that purpose.)

kennethnym commented 2 months ago

if i have xcode installed, i automatically have the command line tools installed as xcode uses those. xcode-select --install indeed reported that i already have the tools installed.

i can verify cc and all others is using the same clang:

$ cc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

i tried to build and use the treesitter lua parser as suggested, but nvim crashes immediately when i open any lua file

clason commented 2 months ago

Yes, but I am asking you to download and install the latest stand-alone tools for the sake of testing.

kennethnym commented 2 months ago

the only way i can "download and install the latest stand-alone tools" is to update xcode as xcode contains them. i updated my xcode to 15.4 and it did not update the compiler version at all. 15.4 is the latest and greatest i can get, and it is still on clang 15.

clason commented 2 months ago

You can download the CLT from the Apple Developer website, or via xcode-select --install.

kennethnym commented 2 months ago

as i have previously stated, xcode-select --install reported that i have them installed. if i have xcode installed, it is automatically installed and included because it is part of the package.

clason commented 2 months ago

Sigh. I know you have a compiler installed; this is not what this is about. For some reason, the compiler on your system is not generating a valid library and I am trying to find out why. One part of this is testing a different compiler, namely a stand-alone CLT installation.

If you are not willing to help investigate this problem, there is nothing I can do to help you.

kennethnym commented 2 months ago
$ xcode-select install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates

do you want me to install xcode 16 CLI beta? i cannot install two copies of the same compiler on the same version. if you want to install something else other than clang, then i can definitely do that.

it appears that there is some misunderstanding between us. i see no reason why you are getting agitated.

clason commented 2 months ago

No, I am asking you to download the XCode 15.3 Command Line Tools from the Apple Developer website. (You can absolutely have multiple different versions installed; you can switch between them with XCode settings or the xcode-select tool.)

If you already have the CLT installed, that could be an issue. What does xcode-select -p print?

Other things we need to look at is your terminal (is it native M1?) and your environment variables.

kennethnym commented 2 months ago

i downloaded xcode 15.3 command line tool as you suggested, and it is reporting the same clang version as the one included in xcode.

15.3 cli clang:

./clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin/.

xcode clang (which is the same because xcode embeds command line tools):

$ clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

as you can see, xcode embeds command line tool as part of the package - standalone cli is equivalent to the one included in xcode.

xcode-select -p:

/Applications/Xcode.app/Contents/Developer

i am on an m1 pro macbook pro, and i use wezterm as my terminal. please let me know what environment variables you need specifically, and i will report them.

kennethnym commented 2 months ago

indeed, i tried to:

xcode-select -s /Library/Developer/CommandLineTools

and then re-compiled the lua parser again and copied the resulting lua.so file into the corresponding directory, and nvim still crashes when i open any lua file.

kennethnym commented 2 months ago

just fyi the same issue persists with other terminal emulators (including the built-in terminal) and even gui neovim wrappers (e.g. goneovim which i actually use)

clason commented 2 months ago

Ok, let's take another step back, then.

kennethnym commented 2 months ago
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.22.6 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.11.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: Apple clang version 15.0.0 (clang-1500.3.9.4)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "arm64",
  release = "23.4.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              x . . . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR vimdoc(highlights): ...m/0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 2:4. Invalid node type "delimiter":
    (delimiter) @markup.heading.1
     ^

  vimdoc(highlights) is concatenated from the following files:
  | [ERROR]:"/tmp/nvim-treesitter/queries/vimdoc/highlights.scm", failed to load: ...m/0.10.0/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 2:4. Invalid node type "delimiter":
    (delimiter) @markup.heading.1
     ^
clason commented 2 months ago

Well, so that worked. That means the issue is somewhere with the config. I'm afraid there's nothing for it than going through it step by step and comparing each difference to the minimal, working, config to find the culprit.

clason commented 2 months ago

You can (and should) also repeat this (after removing the tmp directory) with your installed Neovim. Depending on where you got it from, it could also be the culprit.

nickdichev-firework commented 2 months ago

Thanks for pointing me at the compiler. I am learning nix (and playing around with home-manager) so its frustrating when these sorts of issues (system vs nix compiler) crop up. Here's how I fixed it:

https://github.com/nickdichev/dotfiles/commit/2ff35a9e9c5fb56a1fe982185866b00860bcc5a3#diff-31229fa992b403d35ed9d8652247285873be74fb3210d541767d0cf74a231371R353

https://github.com/nickdichev/dotfiles/commit/4842396f47bc6829ccd65b01417f9ac27b614de4#diff-57338fc2608e2eb6d402d52862b8ca15cb8492f59f257fe33282b77a1a0f04c2R10

I basically pointed the treesitter compiler at the right gcc. With this change my checkhealth reports the gcc in nix store as the compiler and I don't see those uv_dlopen errors.

kennethnym commented 2 months ago

thanks for the help, i will try to reinstall everything and go through my config. closing this for now.

tmvfb commented 1 month ago

Got the same error on a very similar setup (MacOS 22.3.0, neovim 0.10.0, clang version 14.0.3). I only noticed that today on attempt to install new parsers. Reinstalling treesitter led to having this error on all parsers. @kennethnym did you find any solution for this?

UPD: the problem lies within enabling rosetta2 support for my terminal. I went back to a terminal without rosetta2 support and with arm64 processor architecture, reinstalled treesitter again and it works now.