LuaLS / LuaLS/lua-language-server

Lsp error in logs Unknown response id!

Open
#2,302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

Hi. I will appreciate any help.

Sometimes my server responds incorrectly. The server gives some responses eg.

{
  _closeMessage = "Request cancelled.",
  _closeReason = -32800,
  id = 35,
  jsonrpc = "2.0",
  method = "textDocument/semanticTokens/range",
  params = {
    range = {
      end = {
        character = 0,
        line = 0
      },
      start = {
        character = 0,
        line = 0
      }
    },
    textDocument = {
      uri = "---"
    }
  }
}

but the editor shows "workspace loading 0/0" or "Loading".

Even when it responds well, the same error appears in logs

[14:37:50.516][error][#0:script\proto\proto.lua:67]: Unknown response id!	0
stack traceback:
	script\proto\proto.lua:67: in function 'proto.proto.response'
	script\proto\proto.lua:195: in local 'f'
	script\utility.lua:439: in metamethod 'close'
	script\proto\proto.lua:202: in function <script\proto\proto.lua:175>

the difference is that when the server responds correctly, this appears in the logs:

[09:40:35.887][info] [#0:script\provider\diagnostic.lua:557]: Diagnostics scope ... (and here is my workspace folder)

however, when the server is working badly, the following appears in the logs:

[14:37:50.619][info] [#0:script\workspace\workspace.lua:282]: Scan files at: (and here are files from log/cache, not from my workspace I don.t know why.

Maybe someone faced such a problem?

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the LSP response and comparing the logs around script/proto/proto.lua:67, script/proto/proto.lua:195, and script/workspace/workspace.lua:282. Trace why the response receives an unknown id and why workspace scanning uses the logged cache files; done means the failure is reproducible and its cause and fix are verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.