Skip to content

LSP client causing tsgo LSP server to crash due to malformed file path #1812

@golf1052

Description

@golf1052

Describe the bug

When I try to use the Typescript Native (tsgo) LSP server with Copilot CLI I always get the message Error: LSP client not initialized. Running the test command against the client returns this message however

✓ Server "tsgo-inspector" started successfully!

    PID: 8948
    Spawn time: 7ms

  Server was killed after successful test.

I created a proxy LSP server to try and inspect what is going on and it appears that the Copilot CLI is sending malformed paths (at least on Windows) to the tsgo LSP which the LSP then crashes on. Here's the error from tsgo

panic: invalid file URI: file://C:\Users\salautur\Documents\GitHub\GitHubCopilotCliTypescriptNativeDemo

goroutine 10 [running
=====================================
=====================================
[2026-03-03T21:59:53.772Z] SERVER STDERR
-------------------------------------
]:
github.com/microsoft/typescript-go/internal/lsp/lsproto.DocumentUri.FileName({0xbc5274805a0, 0x4e})
	github.com/microsoft/typescript-go/internal/lsp/lsproto/lsp.go:25 +0x254
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleInitialized(0xbc527594e08, {0x7ff7be31c2b8, 0xbc5276e0060}, 0x7ff7bd7586f3?)
	github.com/microsoft/typescript-go/internal/lsp/server.go:1034 +0xda
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerNotificationHandler[...].2({0x7ff7be31c2b8?, 0xbc5276e0060}, 0xb)
	github.com/microsoft/typescript-go/internal/lsp/server.go:704 +0x9e
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xbc527594e08, {0x7ff7be31c2b8?, 0xbc5276e0030?}, 0xbc5275eb5f0)
	github.com/microsoft/typescript-go/internal/lsp/server.go:599 +0xec
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop(0xbc527594e08, {0x7ff7be31c2f0?, 0xbc52753aa50?})
	github.com/microsoft/typescript-go/internal/lsp/server.go:483 +0x41e
github.com/microsoft/typescript-go/internal/lsp.(*Server).Run.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:346 +0x1f
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.19.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/sync@v0.19.0/errgroup/errgroup.go:78 +0x95

I've created a demo program to do the proxy and find this error https://github.com/golf1052/GitHubCopilotCliTypescriptNativeDemo

Affected version

GitHub Copilot CLI 0.0.421

Steps to reproduce the behavior

  1. Add tsgo to LSP config.
    • Native tsgo
      {
        "lspServers": {
          "tsgo-inspector": {
            "command": "npx",
            "args": ["tsgo", "--lsp", "-stdio"],
            "fileExtensions": {
              ".ts": "typescript",
              ".tsx": "typescriptreact",
              ".js": "javascript",
              ".jsx": "javascriptreact"
            }
          }
        }
      }
    • Demo program
      {
        "lspServers": {
          "tsgo-inspector": {
            "command": "node",
            "args": ["C:/Users/salautur/Documents/GitHub/GitHubCopilotCliTypescriptNativeDemo/dist/lsp-inspector.js", "--lsp", "-stdio"],
            "fileExtensions": {
              ".ts": "typescript",
              ".tsx": "typescriptreact",
              ".js": "javascript",
              ".jsx": "javascriptreact"
            }
          }
        }
      }
  2. Start copilot
  3. Run /lsp test tsgo-inspector

Expected behavior

Copilot CLI can use tsgo LSP without it crashing

Additional context

OS Name: Microsoft Windows 11 Enterprise
OS Version: 10.0.26200 N/A Build 26200
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
System Manufacturer: Microsoft Corporation
System Model: Surface Laptop Studio 2
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 186 Stepping 2 GenuineIntel ~2900 Mhz
BIOS Version: Microsoft Corporation 23.101.143, 11/27/2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions