dense-analysis / dense-analysis/ale
gopls client returns with exit code 1 if a go.mod file is present in the same directory
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
## Information
**NVIM version**
```
NVIM v0.10.4
Build type: Release
```
Operating System: Windows 11 Home
Terminal: Windows Terminal 1.22.11141.0
## What went wrong
Everytime I edit or open a go file, the following error pops up in the neovim command line:
`Client gopls:D:\(My project directory) quit with exit code 1 and signal 0. Check log for errors: C:\Users\(My username)\AppData\Local\nvim-data/lsp.log`
The lsp.log file looks something like this:
```
[START][2025-05-28 13:39:25] LSP logging initiated
[ERROR][2025-05-28 13:39:25] .../vim/lsp/rpc.lua:770 "rpc" "cmd" "stderr" 'Der Befehl "/" ist entweder falsch geschrieben oder\r\nkonnte nicht gefunden werden.\r\n'
[ERROR][2025-05-28 13:37:23] .../vim/lsp/rpc.lua:770 "rpc" "cmd" "stderr" 'Der Befehl "/" ist entweder falsch geschrieben oder\r\nkonnte nicht gefunden werden.\r\n'
[ERROR][2025-05-28 13:37:25] .../vim/lsp/rpc.lua:770 "rpc" "cmd" "stderr" 'Der Befehl "/" ist entweder falsch geschrieben oder\r\nkonnte nicht gefunden werden.\r\n'
...
```
The error roughly translates to `'The command "/" is either misspelled or\r\ncould not be found\r\n'`
It turns out that the error will occur if:
1. There is a go.mod file present in the same directory of the go source file that is currently open.
2. ALE is imported
It doesn't matter whether the go.mod file is completely empty or not.
## Reproducing the bug
1. Create a go.mod file
2. Open neovim with a .go file.
3. If the error hasn't appeared yet, write or delete something in the file.
### :ALEInfo
```
Current Filetype: go
Available Linters: ['bingo', 'cspell', 'gobuild', 'gofmt', 'golangci-lint', 'gopls', 'gosimple', 'gotype', 'govet', 'golangserver', 'revive', 'staticcheck']
Linter Aliases:
'gobuild' -> ['go build']
'govet' -> ['go vet']
Enabled Linters: ['gofmt', 'golangci-lint', 'gopls', 'govet']
Ignored Linters: []
Suggested Fixers:
'gofmt' - Fix Go files with go fmt.
'gofumpt' - Fix Go files with gofumpt, a stricter go fmt.
'goimports' - Fix Go files imports with goimports.
'golangci_lint' - Fix Go files with golangci-lint.
'golines' - Fix Go file long lines with golines
'gopls' - Fix Go files with gopls.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:
" Press Space to read :help for a setting
let g:ale_go_go_executable = 'go'
let g:ale_go_golangci_lint_executable = 'golangci-lint'
let g:ale_go_golangci_lint_options = ''
let g:ale_go_golangci_lint_package = 1
let g:ale_go_gopls_executable = 'gopls'
let g:ale_go_gopls_init_options = {}
let g:ale_go_gopls_options = '--mode stdio'
let g:ale_go_gopls_use_global = 0
let g:ale_go_govet_options = ''
let g:ale_go_langserver_executable = 'go-langserver'
let g:ale_go_langserver_options = ''
Global Variables:
" Press Space to read :help for a setting
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = v:false
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = v:true
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = v:false
let g:ale_fixers = {}
let g:ale_history_enabled = v:true
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = v:true
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = v:true
let g:ale_lint_on_filetype_changed = v:true
let g:ale_lint_on_insert_leave = v:true
let g:ale_lint_on_save = v:true
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = v:false
let g:ale_linters_ignore = {}
let g:ale_list_vertical = v:false
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:false
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = v:false
let g:ale_set_highlights = v:true
let g:ale_set_loclist = v:true
let g:ale_set_quickfix = v:false
let g:ale_set_signs = v:true
let g:ale_sign_column_always = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
let g:ale_sign_highlight_linenrs = v:null
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = v:true
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = v:true
let g:ale_warn_about_trailing_whitespace = v:true
Command History:
(executable check - success) gofmt
(finished - exit code 0) 'cmd /s/c "gofmt -e C:\Users\(myusername)\AppData\Local\Temp\nvim.0\VlQs8g\0\main.go"'
<<>>
(executable check - success) golangci-lint
(finished - exit code 0) 'cmd /s/c "cd /d D:\(Project directory) && golangci-lint --version"'
<<>>
golangci-lint has version v2.1.6 built with go1.24.3 from (unknown, modified: ?, mod sum: "h1:LXqShFfAGM5BDzEOWD2SL1IzJAgUOqES/HRBsfKjI+w=") on (unknown)
<<>>
(executable check - success) gopls
(executable check - success) go
(finished - exit code 1) 'cmd /s/c "cd /d D:\(Project directory) && go vet ."'
<<>>
go: error reading go.mod: missing module declaration. To specify the module path:
go mod edit -module=example.com/mod
<<>>
(finished - exit code 3) 'cmd /s/c "cd /d D:\(Project directory) && golangci-lint run --output.json.path stdout --output.text.path stderr --show-stats=0"'
<<>>
(finished - exit code 0) 'cmd /s/c "gofmt -e C:\Users\(my username)\AppData\Local\Temp\nvim.0\VlQs8g\2\main.go"'
<<>>
(finished - exit code 0) 'cmd /s/c "gofmt -e C:\Users\(my username)\AppData\Local\Temp\nvim.0\VlQs8g\3\main.go"'
<<>>
(finished - exit code 0) 'cmd /s/c "gofmt -e C:\Users\(my username)\AppData\Local\Temp\nvim.0\VlQs8g\4\main.go"'
<<>>
```
Contributor guide
Research direction
Start with the ALE gopls and Go linter configuration, then reproduce on Windows using the reported Neovim setup, an empty go.mod, and a Go file. Compare the ALEInfo commands and Neovim lsp.log output, especially the go vet and gopls-related failures. Done means opening or editing the file no longer causes the gopls client to exit with code 1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, vim
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100