help wanted
Description
I created a new project and copy-pasted existing code into new files in that project. When trying to run Eglot (with gleam lsp) in that new project, I got the following log. It told me to report this as a bug here.
(sensitive information obscured)
[jsonrpc] D[14:55:33.510] Running language server: gleam lsp
[jsonrpc] e[14:55:33.561] --> initialize[1] {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":14892,"clientInfo":{"name":"Eglot","version":"1.17.30"},"rootPath":"//wsl.localhost/Debian/home/user/src/project_name/","rootUri":"file://///wsl.localhost/Debian/home/user/src/project_name","initializationOptions":{},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":false,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file://///wsl.localhost/Debian/home/user/src/project_name","name":"//wsl.localhost/Debian/home/user/src/project_name/"}]}}
[stderr] '\\wsl.localhost\Debian\home\user\src\project_name'
[stderr] CMD.EXE was started with the above path as the current directory.
[stderr] UNC paths are not supported. Defaulting to Windows directory.
[jsonrpc] e[14:55:34.348] <-- initialize[1] {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"codeActionProvider":true,"completionProvider":{"triggerCharacters":["."]},"definitionProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"hoverProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"textDocumentSync":{"change":1,"openClose":true,"save":{"includeText":false}},"typeDefinitionProvider":true}}}
[jsonrpc] e[14:55:34.348] --> initialized {"jsonrpc":"2.0","method":"initialized","params":{}}
[jsonrpc] e[14:55:34.409] --> textDocument/didOpen {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file://///wsl.localhost/Debian/home/user/src/project_name/src/session.gleam","version":0,"languageId":"gleam","text":"//// Provides types for the Eclipse Session API.\n\n// Copyright 2026 Company Name\n\nimport eclipse/paths\nimport gleam/dynamic/decode\nimport gleam/http\nimport gleam/http/request\nimport gleam/httpc\nimport gleam/json\nimport gleam/option.{type Option}\nimport gleam/order\nimport gleam/result\nimport gleam/time/duration\nimport gleam/time/timestamp.{type Timestamp}\n\n/// Eclipse SessionUser > Role Schema\npub opaque type Role {\n Role(id: String)\n}\n\n/// Eclipse SessionUser > Company Schema\npub opaque type Company {\n Company(id: String)\n}\n\n/// Eclipse SessionUser Schema\npub opaque type SessionUser {\n SessionUser(\n id: String,\n user_name: String,\n type_: String,\n roles: List(Role),\n companies: Option(List(Company)),\n )\n}\n\n/// Eclipse Session > SessionWmsMenu Schema\npub opaque type SessionWmsMenu {\n SessionWmsMenu(id: String)\n}\n\n/// Eclipse Session Schema\npub opaque type Session {\n Session(\n id: String,\n session_user: SessionUser,\n session_token: String,\n refresh_token: String,\n application_key: String,\n developer_key: String,\n client_description: String,\n device_id: String,\n workstation_id: String,\n printer_location_id: String,\n valid_printer_location_ids: List(String),\n alternate_session_id: String,\n creation_date_time: String,\n last_used_date_time: String,\n expires_in: Int,\n token_type: String,\n wms_menu: List(SessionWmsMenu),\n )\n}\n\n/// If it has been over an hour since the last time we authenticated,\n/// the token has expired.\npub fn token_is_expired(\n current_time: Timestamp,\n last_time_authenticated: Timestamp,\n) -> Bool {\n timestamp.difference(current_time, last_time_authenticated)\n |> duration.compare(duration.hours(-1))\n == order.Gt\n}\n\n/// Query the Eclipse API for a new session token with the given\n/// username and password.\npub fn get_session_token(\n base_url: String,\n username: String,\n password: String,\n) -> Result(String, Nil) {\n use base_req <- result.try(request.to(base_url))\n\n let req =\n base_req\n |> request.prepend_header(\"content-type\", \"application/json\")\n |> request.set_method(http.Post)\n |> request.set_path(paths.sessions)\n |> request.set_body(\n json.to_string(\n json.object([\n #(\"username\", json.string(username)),\n #(\"password\", json.string(password)),\n ]),\n ),\n )\n\n use resp <- result.try(\n httpc.send(req)\n |> result.map_error(fn(_) { Nil }),\n )\n\n case resp.status {\n 200 -> extract_session_token_from_response_body(resp.body)\n _ -> Error(Nil)\n }\n}\n\nfn extract_session_token_from_response_body(body: String) -> Result(String, Nil) {\n use session <- result.try(\n json.parse(body, session_decoder())\n |> result.map_error(fn(_) { Nil }),\n )\n\n Ok(session.session_token)\n}\n\nfn role_decoder() -> decode.Decoder(Role) {\n use id <- decode.field(\"id\", decode.string)\n decode.success(Role(id:))\n}\n\nfn company_decoder() -> decode.Decoder(Company) {\n use id <- decode.field(\"id\", decode.string)\n decode.success(Company(id:))\n}\n\nfn session_user_decoder() -> decode.Decoder(SessionUser) {\n use id <- decode.field(\"id\", decode.string)\n use user_name <- decode.field(\"userName\", decode.string)\n use type_ <- decode.field(\"type\", decode.string)\n use roles <- decode.field(\"roles\", decode.list(role_decoder()))\n use companies <- decode.field(\n \"companies\",\n decode.optional(decode.list(company_decoder())),\n )\n decode.success(SessionUser(id:, user_name:, type_:, roles:, companies:))\n}\n\nfn session_wms_menu_decoder() -> decode.Decoder(SessionWmsMenu) {\n use id <- decode.field(\"id\", decode.string)\n decode.success(SessionWmsMenu(id:))\n}\n\nfn session_decoder() -> decode.Decoder(Session) {\n use id <- decode.field(\"id\", decode.string)\n use session_user <- decode.field(\"sessionUser\", session_user_decoder())\n use session_token <- decode.field(\"sessionToken\", decode.string)\n use refresh_token <- decode.field(\"refreshToken\", decode.string)\n use application_key <- decode.field(\"applicationKey\", decode.string)\n use developer_key <- decode.field(\"developerKey\", decode.string)\n use client_description <- decode.field(\"clientDescription\", decode.string)\n use device_id <- decode.field(\"deviceId\", decode.string)\n use workstation_id <- decode.field(\"workstationId\", decode.string)\n use printer_location_id <- decode.field(\"printerLocationId\", decode.string)\n use valid_printer_location_ids <- decode.field(\n \"validPrinterLocationIds\",\n decode.list(decode.string),\n )\n use alternate_session_id <- decode.field(\"alternateSessionId\", decode.string)\n use creation_date_time <- decode.field(\"creationDateTime\", decode.string)\n use last_used_date_time <- decode.field(\"lastUsedDateTime\", decode.string)\n use expires_in <- decode.field(\"expiresIn\", decode.int)\n use token_type <- decode.field(\"tokenType\", decode.string)\n use wms_menu <- decode.field(\n \"wmsMenu\",\n decode.list(session_wms_menu_decoder()),\n )\n decode.success(Session(\n id:,\n session_user:,\n session_token:,\n refresh_token:,\n application_key:,\n developer_key:,\n client_description:,\n device_id:,\n workstation_id:,\n printer_location_id:,\n valid_printer_location_ids:,\n alternate_session_id:,\n creation_date_time:,\n last_used_date_time:,\n expires_in:,\n token_type:,\n wms_menu:,\n ))\n}\n"}}}
[stderr] error: Fatal compiler bug!
[stderr]
[stderr] This is a bug in the Gleam compiler, sorry!
[stderr]
[stderr] Please report this crash to https://github.com/gleam-lang/gleam/issues/new
[stderr] and include this error message with your report.
[stderr]
[stderr] Panic: compiler-core\src\language_server.rs:110
[stderr] URL file: ()
[stderr] Gleam version: 1.14.0
[stderr] Operating system: windows
[stderr]
[stderr] If you can also share your code and say what file you were editing or any
[stderr] steps to reproduce the crash that would be a great help.
[stderr]
[stderr] You may also want to try again with the `GLEAM_LOG=trace` environment
[stderr] variable set.
[stderr]
[jsonrpc] e[14:55:34.639] <-- window/workDoneProgress/create[create-token--downloading-dependencies] {"jsonrpc":"2.0","id":"create-token--downloading-dependencies","method":"window/workDoneProgress/create","params":{"token":"downloading-dependencies"}}
[jsonrpc] e[14:55:34.639] <-- client/registerCapability[1] {"jsonrpc":"2.0","id":1,"method":"client/registerCapability","params":{"registrations":[{"id":"watch-gleam-toml","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/gleam.toml","kind":2}]}}]}}
[jsonrpc] D[14:55:34.834] Connection state change: `exited abnormally with code 101
'
----------b---y---e---b---y---e----------
[stderr]
[stderr]
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (eclipse_connector/(gleam-ts-mode)) stderr finished