no-go.nvim: Failed to parse query. Try updating the parser with :TSUpdate go #7

Closed
opened 2025-11-18 02:28:05 -06:00 by edte · 10 comments
edte commented 2025-11-18 02:28:05 -06:00 (Migrated from github.com)

error

Image

after add log and report

Image

...os-arm64/share/nvim/runtime/lua/vim/treesitter/query.lua:374: Query error at 6:8. Invalid node type "statement_list": (statement_list

after exec TSUpdate go nothing happen

https://github.com/user-attachments/assets/7d71ff1b-e8cb-4d81-a0d6-1b8a056afab7

test file

main.go

package main

import (
	"errors"
	"fmt"
)

func main() {
	err := errors.New("test")
	if err != nil {
		fmt.Println(err.Error())
	}
}

version

nvim
NVIM v0.12.0-dev-1622+g30634f63e2 Build type: RelWithDebInfo LuaJIT 2.1.1763148144 Run "nvim -V1 -v" for more info

tressiter
master or main lastest also happen

Image

check

checkhealth nvim-treesitter

Image Image

checkhealth vim.treesitter

Image
# error <img width="1727" height="1078" alt="Image" src="https://github.com/user-attachments/assets/9270fc94-dceb-4a47-bd86-9cb29ac9cb32" /> after add log and report <img width="1316" height="591" alt="Image" src="https://github.com/user-attachments/assets/ecd32657-0295-4c6e-b561-863890dc8f04" /> ` ...os-arm64/share/nvim/runtime/lua/vim/treesitter/query.lua:374: Query error at 6:8. Invalid node type "statement_list": (statement_list ` after exec `TSUpdate go` nothing happen https://github.com/user-attachments/assets/7d71ff1b-e8cb-4d81-a0d6-1b8a056afab7 # test file main.go ``` package main import ( "errors" "fmt" ) func main() { err := errors.New("test") if err != nil { fmt.Println(err.Error()) } } ``` # version nvim ` NVIM v0.12.0-dev-1622+g30634f63e2 Build type: RelWithDebInfo LuaJIT 2.1.1763148144 Run "nvim -V1 -v" for more info ` tressiter master or main lastest also happen <img width="756" height="310" alt="Image" src="https://github.com/user-attachments/assets/6589f907-e384-4561-bf5c-fd679ef5e923" /> # check checkhealth nvim-treesitter <img width="1387" height="1028" alt="Image" src="https://github.com/user-attachments/assets/b8fd1688-b1c7-46c7-86e6-f4cab59277da" /> <img width="884" height="558" alt="Image" src="https://github.com/user-attachments/assets/7c347961-74db-4809-a0a2-d1701ad45b2f" /> checkhealth vim.treesitter <img width="1536" height="976" alt="Image" src="https://github.com/user-attachments/assets/528f51d4-4793-4d05-a196-cab6af1a277b" />
cybershape commented 2025-11-18 02:42:18 -06:00 (Migrated from github.com)

same here. after remove the (statement_list), the query would get parsed.

same here. after remove the (statement_list), the query would get parsed.
Owner

I will take a look at this soon. Thanks for reporting in such a helpful way. It helps!

I will take a look at this soon. Thanks for reporting in such a helpful way. It helps!
Owner

@tiejunhu Are you also on the v.12 of neovim?

@edte I have looked into this with the test file, and it seems to work fine.

Image

Are you both sure that you are on the main branch of Treesiter, and fully updated?

The error you are getting,

I will take a closer look this weekend, but the fact that both:

  • the test file worked for me as expected
  • Error is saying that the node type is invalid.

Makes me think that there is something strange/outdated with your installation of treesitter.

Are you sure the test file replicated this issue?

@tiejunhu Are you also on the v.12 of neovim? @edte I have looked into this with the test file, and it seems to work fine. <img width="320" height="186" alt="Image" src="https://github.com/user-attachments/assets/5b42d7c3-0c3e-4821-ad21-06b977ae6b10" /> Are you both sure that you are on the main branch of Treesiter, and fully updated? The error you are getting, I will take a closer look this weekend, but the fact that both: - the test file worked for me as expected - Error is saying that the node type is invalid. Makes me think that there is something strange/outdated with your installation of treesitter. Are you sure the test file replicated this issue?
edte commented 2025-11-19 04:47:56 -06:00 (Migrated from github.com)
  • the main branch of Treesiter and lastest commit

  • the test file replicated this issue

and the error is

...os-arm64/share/nvim/runtime/lua/vim/treesitter/query.lua:374: Query error at 6:8. Invalid node type "statement_list": (statement_list

- [x] the main branch of Treesiter and lastest commit - [x] the test file replicated this issue and the error is ``` ...os-arm64/share/nvim/runtime/lua/vim/treesitter/query.lua:374: Query error at 6:8. Invalid node type "statement_list": (statement_list ```
longthanhtran commented 2025-11-19 20:18:58 -06:00 (Migrated from github.com)

I have the same issue, and use nvim 0.11.5 (macos). Here is the log when I try with the sample file

Error detected while processing BufReadPost Autocommands for "":
Error executing lua callback: ...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "
"..FileType Autocommands for "go": Vim(append):no-go.nvi
m: Failed to parse error query. Try updating the parser with :TSUpdate go
stack traceback:
[C]: in function '_with'
...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:35: in function <...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:10>

I have the same issue, and use nvim 0.11.5 (macos). Here is the log when I try with the sample file > Error detected while processing BufReadPost Autocommands for "*": Error executing lua callback: ...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "go": Vim(append):no-go.nvi m: Failed to parse error query. Try updating the parser with :TSUpdate go stack traceback: [C]: in function '_with' ...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:35: in function <...rew/Cellar/neovim/0.11.5/share/nvim/runtime/filetype.lua:10>
cybershape commented 2025-11-19 21:06:35 -06:00 (Migrated from github.com)

My bad. I'm on treesitter's master branch. After I switch to main branch, the issue is gone.

Didn't notice that treesitter switched latest branch from master to main.

Everyone with this issue should double check the treesitter config. The main branch of treesitter is not the default branch. You need to specify it.

@tiejunhu Are you also on the v.12 of neovim?

@edte I have looked into this with the test file, and it seems to work fine.

Image Are you both sure that you are on the main branch of Treesiter, and fully updated?

The error you are getting,

I will take a closer look this weekend, but the fact that both:

  • the test file worked for me as expected
  • Error is saying that the node type is invalid.

Makes me think that there is something strange/outdated with your installation of treesitter.

Are you sure the test file replicated this issue?

My bad. I'm on treesitter's master branch. After I switch to main branch, the issue is gone. Didn't notice that treesitter switched latest branch from master to main. Everyone with this issue should double check the treesitter config. The main branch of treesitter is not the default branch. You need to specify it. > [@tiejunhu](https://github.com/tiejunhu) Are you also on the v.12 of neovim? > > [@edte](https://github.com/edte) I have looked into this with the test file, and it seems to work fine. > > <img alt="Image" width="320" height="186" src="https://private-user-images.githubusercontent.com/144077737/516169374-5b42d7c3-0c3e-4821-ad21-06b977ae6b10.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM2MDY4NDAsIm5iZiI6MTc2MzYwNjU0MCwicGF0aCI6Ii8xNDQwNzc3MzcvNTE2MTY5Mzc0LTViNDJkN2MzLTBjM2UtNDgyMS1hZDIxLTA2Yjk3N2FlNmIxMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUxMTIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MTEyMFQwMjQyMjBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZTA3NTgyYzEyN2NhY2RmODNkMTU0ODIwZWY0ZjEyNTE3YjcwYTQyOTc0N2YwOGI1NDM0ZmE4MjJjODQyZTUyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.J9KrCpyiUjBv4Z6YAERp7mFWkXO3eJoX8zJWcWgWrEE"> > Are you both sure that you are on the main branch of Treesiter, and fully updated? > > The error you are getting, > > I will take a closer look this weekend, but the fact that both: > > * the test file worked for me as expected > * Error is saying that the node type is invalid. > > Makes me think that there is something strange/outdated with your installation of treesitter. > > Are you sure the test file replicated this issue?
longthanhtran commented 2025-11-19 22:46:26 -06:00 (Migrated from github.com)

yes, my nvim-treesitter still on master branch and switching to main creates so many issues with other settings / configs / plugins.

yes, my nvim-treesitter still on master branch and switching to main creates so many issues with other settings / configs / plugins.
Owner

@longthanhtran
@edte

Sorry guys, but I will not be supporting the master branch of Treesitter. Please read their readme, as the main branch (which is not the default branch) will become the new default branch at some point.

Supporting the branch that is planned to be deprecated it not a good idea.

Read the comment @tiejunhu left, as switching to the 'main' branch fixed the issue for him. If switching to the main branch is giving you issues, I suggest taking some time to work through it.

I will be closing out this issue, and labeling it as won't fix.

You are more than welcome to fork the repository and delete the statement list line.

@longthanhtran @edte Sorry guys, but I will _not_ be supporting the master branch of Treesitter. Please read their readme, as the main branch (which is not the default branch) will become the new default branch at some point. Supporting the branch that is planned to be deprecated it not a good idea. Read the comment @tiejunhu left, as switching to the 'main' branch fixed the issue for him. If switching to the main branch is giving you issues, I suggest taking some time to work through it. I will be closing out this issue, and labeling it as won't fix. You are more than welcome to fork the repository and delete the statement list line.
longthanhtran commented 2025-11-21 08:42:45 -06:00 (Migrated from github.com)

Sorry for comment on this closed issue, just want to update from my side. nvim-treesitter still on master (the freezing branch) and with all standard settings on my nvim. It works, but only case with return

Image Image

so if the optional operator moves 1 level in the error_query then this should cover both cases, with / without return

Image Image
Sorry for comment on this closed issue, just want to update from my side. nvim-treesitter still on master (the freezing branch) and with all standard settings on my nvim. _It works_, but only case with `return` <img width="702" height="341" alt="Image" src="https://github.com/user-attachments/assets/e7bcbc73-0dd4-4f55-a385-8097b17b4a58" /> <img width="717" height="410" alt="Image" src="https://github.com/user-attachments/assets/e11a0c0f-177f-4615-b97e-d0863744c1e4" /> so if the optional operator moves 1 level in the error_query then this should cover both cases, with / without `return` <img width="1410" height="650" alt="Image" src="https://github.com/user-attachments/assets/ea704bb9-2248-487c-8f59-4e93381f478f" /> <img width="717" height="274" alt="Image" src="https://github.com/user-attachments/assets/224e535f-18c6-4955-92e0-ee3cf442c302" />
Owner

Ah yes, i though about this. I decided against it. In Go, the error handing pattern is, the caller of the function deals with the error. I did not want to fold that! As sometimes, those consequences without returns, are things that should not be concealed. Such as, a panic. This also stops potentially dangerous code from being hidden. I dont like the idea of hiding err consequences without returns.

But, this is opinionated. If you want that as a feature, you can open an issue, and i can make it optional. This is out of the scope of this issue, though.

Ah yes, i though about this. I decided against it. In Go, the error handing pattern is, the _caller_ of the function deals with the error. I did not want to fold that! As sometimes, those consequences without returns, are things that should not be concealed. Such as, a panic. This also stops potentially dangerous code from being hidden. I dont like the idea of hiding err consequences without returns. But, this is opinionated. If you want that as a feature, you can open an issue, and i can make it optional. This is out of the scope of this issue, though.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
noe.trevino/no-go.nvim#7
No description provided.