Skip to content

Crash with invalid JSON #517

Open
Open
@NobbZ

Description

@NobbZ

After some while of working (usually about 30 to 60 minutes) next-ls crashes and can not recover.

After some digging I found the following logs in .elixir-tools/next-ls.log, but not in the "Next LS" output pane of VS Code, I am therefore unsure whether this is a problem of the VScode plugin or NextLS.

14:36:33.638 [error] GenServer NextLS.Buffer terminating
** (Jason.DecodeError) unexpected end of input at position 286
    (jason 1.4.1) lib/jason.ex:92: Jason.decode!/2
    (gen_lsp 0.10.0) lib/gen_lsp/buffer.ex:87: anonymous fn/3 in GenLSP.Buffer.handle_cast/2
    (telemetry 1.2.1) /Users/runner/work/next-ls/next-ls/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (gen_lsp 0.10.0) lib/gen_lsp/buffer.ex:85: GenLSP.Buffer.handle_cast/2
    (stdlib 5.2) gen_server.erl:1121: :gen_server.try_handle_cast/3
    (stdlib 5.2) gen_server.erl:1183: :gen_server.handle_msg/6
    (stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:incoming, "\n{\"jsonrpc\":\"2.0\",\"id\":1112,\"method\":\"textDocument/completion\",\"params\":{\"textDocument\":{\"uri\":\"file:///home/nmelzer/Projects/BravoBike/**redacted****/apps/frontend/lib/frontend/live/**redacted****/overview.ex\"},\"position\":{\"line\":141,\"character\":21},\"context\":{\"triggerKind\":1}}"}}
State: %{lsp: #PID<0.256.0>, awaiting_response: %{}, comm_data: nil, comm: GenLSP.Communication.Stdio}

In fact the JSON snippet seen in the last message looks like this after clean up:

{
    "jsonrpc":"2.0",
    "id":1112,
    "method":"textDocument/completion",
    "params":{
        "textDocument":{
            "uri":""file:///home/nmelzer/Projects/BravoBike/**redacted****/apps/frontend/lib/frontend/live/**redacted****/overview.ex"
        },
        "position":{
            "line":141,
            "character":21
        },
        "context":{
            "triggerKind":1
        }
    }

So there is a closing curly brace missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions