Skip to content

Neovim LSP crash on file save: Mismatch between server and client text #1388

@kshofmeester

Description

@kshofmeester

Description
I received the "Please contact us!" crash notification in Neovim. The language server crashed upon saving a file due to a Mismatch between server and client text error.

To Reproduce
I was working in Neovim and saved a file (src/iohelpers.jl). It appears the server's internal representation of the file was empty compared to the client. Just before the crash, there was one tab opened containing three windows split vertically: a file tree, ffile.jl, and src/iohelpers.jl. The last edits prior to the crash were: a yank from ffile.jl of ~90 lines of code (gg<S-v>Gy) + switch focused window (<C-l>) + a put (paste) of the yanked code in src/iohelpers.jl (p) + save src/iohelpers.jl (:w).

Environment:

  • OS: macOS Tahoe 26.4.1
  • Editor: Neovim v0.12.2 (in iTerm2)
  • Julia version 1.12.6
  • LSP client: Neovim LSP using nvim-lspconfig
  • Other plugins: GitHub Copilot (via zbirenbaum/copilot.lua) running concurrently
  • No auto-formatters running on save

Relevant LSP configuration (from lspconfig.lua):

vim.lsp.config("julials", {
  settings = {
    julia = {
      lint = {
        missingrefs = "symbols",
      },
    },
  },
})

LSP Log / Stacktrace:

Mismatch between server and client text for file:///path/to/project/src/iohelpers.jl. _open_in_editor is false. _workspace_file is true. _version is 0.

Stacktrace:
 [1] textDocument_didSave_notification(params::LanguageServer.DidSaveTextDocumentParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint, JSON.Serializations.StandardSerialization})
   @ LanguageServer ~/.julia/packages/LanguageServer/gZWBR/src/requests/textdocument.jl:91
 [2] (::LanguageServer.var"#notification_wrapper##0#notification_wrapper##1"{typeof(LanguageServer.textDocument_didSave_notification), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint, JSON.Serializations.StandardSerialization}, params::LanguageServer.DidSaveTextDocumentParams)
   @ LanguageServer ~/.julia/packages/LanguageServer/gZWBR/src/languageserverinstance.jl:338
 [3] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint, JSON.Serializations.StandardSerialization}, dispatcher::JSONRPC.MsgDispatcher, msg::JSONRPC.Request)
   @ JSONRPC ~/.julia/packages/JSONRPC/pInnH/src/typed.jl:0
 [4] run(server::LanguageServerInstance; timings::Vector{Any})
   @ LanguageServer ~/.julia/packages/LanguageServer/gZWBR/src/languageserverinstance.jl:474
 [5] run(server::LanguageServerInstance)
   @ LanguageServer ~/.julia/packages/LanguageServer/gZWBR/src/languageserverinstance.jl:348
 [6] top-level scope
   @ none:31
 [7] eval(m::Module, e::Any)
   @ Core ./boot.jl:489
 [8] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:283
 [9] _start()
   @ Base ./client.jl:550

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions