python filetype nil bug

Open
#4,956 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua, python, vim
Domain
tooling

Research direction

Reproduce the error by opening a .py file with Neovim 0.11, then inspect lua/ale/lsp.lua around the send_message and initialization paths at lines 135 and 88. Compare the message reaching Neovim's runtime/lua/vim/lsp/rpc.lua:281 and verify that Python linting no longer triggers the table-key serialization error.

Written by the indexing model from the issue text.

Description

bug

Information

neovim 0.11

Operating System: macos 15.4

What went wrong

                 Error executing vim.schedule lua callback: function ale#lsp#CallInitCallbacks[11]..<lambda>38[1]..ale#lsp_linter#OnInit[7]..ale#lsp#UpdateConfig[10]..ale#lsp#Send, line 12: Vim(return):E5108: Error executing lua ...lar/neovim/0.11.0/share/nvim/runtime/lua/vim/lsp/rpc.lua:281: Cannot serialise boolean: table key must be a number or string

stack traceback:
[C]: in function 'encode'
...lar/neovim/0.11.0/share/nvim/runtime/lua/vim/lsp/rpc.lua:281: in function 'notify'
.../neovim/0.11.0/share/nvim/runtime/lua/vim/lsp/client.lua:766: in function 'notify'
...rs/chenxu/software/nvim/lazy/plugins/ale/lua/ale/lsp.lua:135: in function 'send_message'
[string "luaeval()"]:1: in main chunk
[C]: in function 'ale#lsp#CallInitCallbacks'
...rs/chenxu/software/nvim/lazy/plugins/ale/lua/ale/lsp.lua:88: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
[C]: in function 'ale#lsp#CallInitCallbacks'
...rs/chenxu/software/nvim/lazy/plugins/ale/lua/ale/lsp.lua:88: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

Reproducing the bug

only python file cause this errors
open a .py file

:ALEInfo

Current Filetype: python
Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycln', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'refurb', 'ruff', 'unimport', 'vulture']
Linter Aliases:
'jedils' -> ['jedi_language_server']
Enabled Linters: ['flake8', 'mypy', 'pylint', 'pyright', 'ruff']
Ignored Linters: []
Suggested Fixers:
'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
'autoflake' - Fix flake issues with autoflake.
'autoimport' - Fix import issues with autoimport.
'autopep8' - Fix PEP8 issues with autopep8.
'black' - Fix PEP8 issues with black.
'isort' - Sort Python imports with isort.
'pycln' - remove unused python import statements
'pyflyby' - Tidy Python imports with pyflyby.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'reorder-python-imports' - Sort Python imports with reorder-python-imports.
'ruff' - A python linter/fixer for Python written in Rust
'ruff_format' - Fix python files with the ruff formatter.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'yapf' - Fix Python files with yapf.

Linter Variables:
" Press Space to read :help for a setting
let g:ale_python_auto_pipenv = v:false
let g:ale_python_auto_poetry = v:false
let g:ale_python_auto_uv = v:false
let g:ale_python_auto_virtualenv = v:false
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_auto_poetry = 0
let g:ale_python_flake8_auto_uv = 0
let g:ale_python_flake8_change_directory = 'project'
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = '--max-line-length=200 --indent-size=2'
let g:ale_python_flake8_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_auto_uv = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
let g:ale_python_pylint_auto_pipenv = 0
let g:ale_python_pylint_auto_poetry = 0
let g:ale_python_pylint_auto_uv = 0
let g:ale_python_pylint_change_directory = 1
let g:ale_python_pylint_executable = 'pylint'
let g:ale_python_pylint_options = ''
let g:ale_python_pylint_use_global = 0
let g:ale_python_pylint_use_msg_id = 0
let g:ale_python_pyright_auto_pipenv = 0
let g:ale_python_pyright_auto_poetry = 0
let g:ale_python_pyright_auto_uv = 0
let g:ale_python_pyright_config = {}
let g:ale_python_pyright_executable = 'pyright-langserver'
let g:ale_python_pyright_use_global = 0
let g:ale_python_ruff_auto_pipenv = 0
let g:ale_python_ruff_auto_poetry = 0
let g:ale_python_ruff_auto_uv = 0
let g:ale_python_ruff_change_directory = 1
let g:ale_python_ruff_executable = 'ruff'
let g:ale_python_ruff_options = ''
let g:ale_python_ruff_use_global = 0

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 = {'c': ['ccls', 'cspell'], 'sh': ['cspell'], 'markdown': ['languagetool'], 'lua': ['cspell'], 'asciidoc': ['languagetool'], 'rubyinfo': ['cspell'], 'cpp': ['ccls', 'cspell', 'clangtidy', 'cc', 'cpplint', 'flawfinder'], 'ruby': ['cspell']}
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 = 'disabled'
let g:ale_warn_about_trailing_blank_lines = v:true
let g:ale_warn_about_trailing_whitespace = v:true

Command History:

(finished - exit code 0) ['/bin/zsh', '-c', '''pylint'' --version']

<<>>
pylint 3.3.6
astroid 3.3.9
Python 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 16.0.0 (clang-1600.0.26.6)]
<<>>

(executable check - success) flake8
(finished - exit code 0) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''flake8'' --version']

<<>>
7.2.0 (mccabe: 0.7.0, pycodestyle: 2.13.0, pyflakes: 3.3.2) CPython 3.13.3 on
Darwin
<<>>

(executable check - success) mypy
(finished - exit code 0) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''mypy'' --show-column-numbers --shadow-file ''/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py'' ''/var/folders/05/dfw4d4ds0nx2xyyn7yt5ky3r0000gn/T/nvim.chenxu/55tP49/2/aa.py'' ''/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py''']

<<>>
Success: no issues found in 1 source file
<<>>

(executable check - success) pylint
(finished - exit code 0) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''pylint'' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n --from-stdin ''/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py'' < ''/var/folders/05/dfw4d4ds0nx2xyyn7yt5ky3r0000gn/T/nvim.chenxu/55tP49/3/aa.py''']

<<>>


Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

<<>>

(executable check - success) pyright-langserver
(executable check - success) ruff
(finished - exit code 0) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''ruff'' --version']

<<>>
ruff 0.11.4
<<>>

(finished - exit code 1) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''ruff'' check -q --no-fix --output-format json-lines --stdin-filename ''/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py'' - < ''/var/folders/05/dfw4d4ds0nx2xyyn7yt5ky3r0000gn/T/nvim.chenxu/55tP49/4/aa.py''']

<<>>
{"cell":null,"code":"F401","end_location":{"column":13,"row":1},"filename":"/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py","fix":{"applicability":"safe","edits":[{"content":"","end_location":{"column":1,"row":2},"location":{"column":1,"row":1}}],"message":"Remove unused import: numpy"},"location":{"column":8,"row":1},"message":"numpy imported but unused","noqa_row":1,"url":"https://docs.astral.sh/ruff/rules/unused-import"}
<<>>

(finished - exit code 1) ['/bin/zsh', '-c', 'cd ''/Users/chenxu/cx_rc'' && ''flake8'' --max-line-length=200 --indent-size=2 --format=default --stdin-display-name ''/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py'' - < ''/var/folders/05/dfw4d4ds0nx2xyyn7yt5ky3r0000gn/T/nvim.chenxu/55tP49/5/aa.py''']

<<>>
/Users/chenxu/cx_rc/config/nvim/lua/plugins/aa.py:1:1: F401 'numpy' imported but unused
<<>>

Dominant language
Vim Script
Stars
14k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dense-analysis/ale

All issues in dense-analysis/ale

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.