You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Strings containing escapes resembling malformed UTF-8 crash the LSP #61
Interacting with strings containing escapes that appear like broken UTF-8, crashes the entire LSP. This includes interacting with variables containing those strings.
Replication:
Write the following code:
localfail="\xC2"
Attempt to hover the string or reference the variable
Language server crashes with an UTF-8 parse error:
2026-08-14T22:28:31+02:00 ERROR [crates/lsp/src/lsp.rs:547] invalid utf-8 sequence of 1 bytes from index 113
2026-08-14T22:28:31+02:00 ERROR [lsp] Server reset connection for a request "textDocument/hover" id 18
2026-08-14T22:28:31+02:00 WARN [project::lsp_store] Get hover via lua-language-server failed: Server reset the connection
2026-08-14T22:28:31+02:00 ERROR [project::lsp_store] Error handling response for request GetHover { position: PointUtf16 { row: 0, column: 14 } }: Get hover via lua-language-server failed: Server reset the connection
2026-08-14T22:28:32+02:00 WARN [project::lsp_store] Get hover via lua-language-server failed: server shut down
The language server does not come back online.
Expected behaviour:
It should not crash on any kind of escaped sequence contained within string literals. If the sequence cannot be interpreted for display, it should be reported as-is or escaped bytewise, similar to what clangd does:
// Send:
{"jsonrpc":"2.0","id":5,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/peter/source/zed-lua/a.lua"},"position":{"line":0,"character":16}}}
2026-08-14T19:17:50-04:00 ERROR [crates/lsp/src/lsp.rs:563] invalid utf-8 sequence of 1 bytes from index 112
2026-08-14T19:17:50-04:00 ERROR [lsp] Server reset connection for a request "textDocument/hover" id 5
2026-08-14T19:17:50-04:00 WARN [project::lsp_store] Get hover via lua-language-server failed: Server reset the connection
2026-08-14T19:17:50-04:00 ERROR [project::lsp_store] Error handling response for request GetHover { position: PointUtf16 { row: 0, column: 16 } }: Get hover via lua-language-server failed: Server reset the connection
Zed should perhaps more gracefully handle/recovery receiving invalid data. This should probably be a distinct issue/discussion on the Zed repo. I'm not sure what the correct solution (try to recover? kill the LSP and restart? etc).
Activity
notpeter commentedon Aug 16, 2026
I can reproduce on macOS.
There are two bugs here:
fix: more invalid UTF-8 JSON in hover/completions LuaLS/lua-language-server#3451