Skip to content

lua-language-server crashes with “attempt to index a number value (local 'k')” in locale-loader #2057

@varunpenumudi

Description

@varunpenumudi

I've searched open issues for similar requests

  • Yes

I've manually reviewed logs to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

When starting Neovim with LSP logging enabled and using lua-language-server, I consistently get the following error from the language server’s stderr:

I see this in my Neovim LSP log (LSP log started with verbose logging enabled):

[ERROR][2026-01-10 10:21:26] ...p/_transport.lua:36	"rpc"	"lua-language-server"	"stderr"	"script/locale-
loader.lua:5: attempt to index a number value (local 'k')\nstack traceback:\n\tscript/locale-loader.lua:5: in upvalue 
'mergeKey'\n\tscript/locale-loader.lua:18: in metamethod 'newindex'\n\t...ckages/lua-language-
server/libexec/locale/en-us/meta.lua:885: in main chunk\n\tscript/locale-loader.lua:25: in function 'locale-
loader'\n\t[C]: in global 'xpcall'\n\tscript/library.lua:210: in upvalue 'loadMetaLocale'\n\tscript/library.lua:230: in 
upvalue 'initBuiltIn'\n\tscript/library.lua:668: in upvalue 'callback'\n\tscript/workspace/workspace.lua:31: in function 
<script/workspace/workspace.lua:30>\n"

This error appears twice in the logs on startup (once for each locale initialization). It looks like a value expected to be a table is instead a number, causing a failure in the locale loading code.

Expected behavior

When launching Neovim with the Lua language server (lua-language-server) configured for LSP, the language server should start without stderr errors and load all locale/meta data cleanly. There should be no “attempt to index a number value (local ‘k’)” errors in the LSP logs, and the server should function normally (providing completions, diagnostics, etc.) without crashing or failing to initialize. This mirrors the expected behavior seen with other language servers and earlier versions of LuaLS, where no locale loading errors are emitted.

Steps to reproduce

  1. install nvim-lspconfig, mason with lazy-nvim plugin manager
  2. Install lua-language-server with "MasonInstall lua-language-server"
  3. Configure Neovim to use the Lua LSP (lua_ls) via vim.lsp config.```
        vim.lsp.config("lua_ls", {
              cmd = { 'lua-language-server' },
              filetypes = { 'lua' },
              root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
              capabilities = require('blink.cmp').get_lsp_capabilities(),
              settings = {
                  Lua = {
                      runtime = {
                          version = 'LuaJIT',
                      },
                      -- 1. Tell the server that 'vim' is a global variable
                      diagnostics = {
                          globals = { 'vim' },
                      },
                      -- 2. (Optional but recommended) Add Neovim runtime files to workspace 
                      workspace = {
                          library = vim.api.nvim_get_runtime_file("", true),
                          checkThirdParty = false, -- Stops the "Do you want to configure environment?" prompt
                      },
                      telemetry = {
                          enable = false,
                      },
                  }
              }
        })
  1. Open a Lua file in Neovim so that the Lua language server starts.
  2. Observe the LSP log output

Affected packages

lua_ls

Neovim version (>= 0.10.0)

NVIM v0.11.5
Build type: RelWithDebInfo
LuaJIT 2.1.1741730670
Run "nvim -V1 -v" for more info

Operating system/version

Ubuntu 22.04.5 LTS Release (WSL)

Healthcheck

==============================================================================
mason:                                                                   10 ⚠️

mason.nvim ~
- ✅ OK mason.nvim version v2.2.1
- ✅ OK PATH: prepend
- ✅ OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- ✅ OK neovim version >= 0.10.0

mason.nvim [Registries] ~
- ✅ OK Registry `github.com/mason-org/mason-registry version: 2026-01-10-ample-drum` is installed.
- ✅ OK Registry `SynthesizedRegistrySource` is installed.

mason.nvim [Core utils] ~
- ✅ OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- ✅ OK wget: `GNU Wget 1.21.2, a non-interactive network retriever.`
- ✅ OK curl: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.19`
- ✅ OK gzip: `gzip 1.10`
- ✅ OK tar: `tar (GNU tar) 1.34`
- ✅ OK bash: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`

mason.nvim [Languages] ~
- ⚠️ WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. Could not find executable "go" in PATH.

- ⚠️ WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. Could not find executable "luarocks" in PATH.

- ⚠️ WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. Could not find executable "ruby" in PATH.

- ⚠️ WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem failed with exit code - and signal -. Could not find executable "gem" in PATH.

- ⚠️ WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. Could not find executable "composer" in PATH.

- ⚠️ WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. Could not find executable "php" in PATH.

- ⚠️ WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. Could not find executable "javac" in PATH.

- ⚠️ WARNING java: not available
  - ADVICE:
    - spawn: java failed with exit code - and signal -. Could not find executable "java" in PATH.

- ⚠️ WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. Could not find executable "julia" in PATH.

- ✅ OK python: `Python 3.10.12`
- ⚠️ WARNING node: unsupported version `v12.22.9`
  - ADVICE:
    - Node version must be >= 14
- ✅ OK cargo: `cargo 1.73.0 (9c4383fb5 2023-08-26)`
- ✅ OK npm: `8.5.1`
- ✅ OK pip: `pip 25.3 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)`
- ✅ OK python venv: `Ok`

Screenshots or recordings

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions