Skip to content

Strings containing escapes resembling malformed UTF-8 crash the LSP #61

Description

@evolbug

Environment:

  • Fedora Linux 44
  • Zed 1.15.0 (Flatpak)
  • Lua plugin 0.1.10
  • LuaLS 3.19.1

Issue:

Interacting with strings containing escapes that appear like broken UTF-8, crashes the entire LSP. This includes interacting with variables containing those strings.

Replication:

  1. Write the following code:
local fail = "\xC2"
  1. Attempt to hover the string or reference the variable
  2. 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
  1. 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:

Image

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