microsoft/typescript-go · error
request failed: %s
Error message
request failed: %s
What it means
Returned by sendClientRequest when a server-to-client request (e.g. workspace/configuration, client/registerCapability, window/workDoneProgress/create) completes and the client replied with a JSON-RPC error response instead of a result. The %s is resp.Error.String(), so the client's own code and message are embedded. It is a normal protocol-level failure: the request was delivered, the client just refused or failed it.
Source
Thrown at internal/lsp/server.go:683
defer func() {
s.pendingServerRequestsMu.Lock()
defer s.pendingServerRequestsMu.Unlock()
if respChan, ok := s.pendingServerRequests[*id]; ok {
close(respChan)
delete(s.pendingServerRequests, *id)
}
}()
if err := s.send(req.Message()); err != nil {
return *new(Resp), err
}
select {
case <-ctx.Done():
return *new(Resp), ctx.Err()
case resp := <-responseChan:
if resp.Error != nil {
return *new(Resp), fmt.Errorf("request failed: %s", resp.Error.String())
}
return info.UnmarshalResult(resp.Result)
}
}
// sendClientRequestFireAndForget sends a request to the client without waiting for a response.
// The response, if any, will be silently ignored by the read loop since no pending channel is registered.
// This means any error returned by the client will not be observed. Use only for requests where the
// response value is not needed (e.g., the client always returns null).
func sendClientRequestFireAndForget[Req, Resp any](s *Server, info lsproto.RequestInfo[Req, Resp], params Req) error {
id := jsonrpc.NewIDString(fmt.Sprintf("ts%d", s.clientSeq.Add(1)))
req := info.NewRequestMessage(id, params)
return s.send(req.Message())
}
func (s *Server) sendResult(id *jsonrpc.ID, result any) error {
return s.sendResponse(&lsproto.ResponseMessage{
ID: id,View on GitHub (pinned to 1bcfa18d79)
Solutions
- Read the embedded client error text; it names the client's code (e.g. MethodNotFound, InvalidParams) which pinpoints the cause
- Gate server-to-client requests on the capabilities returned in initialize before calling them
- For optional integrations (telemetry, progress), treat this error as non-fatal and degrade gracefully
- Upgrade the client/editor if the method requires a newer LSP revision
Example fix
// before
resp, err := sendClientRequest(ctx, s, lsproto.WorkspaceConfigurationInfo, params)
if err != nil {
return zero, err
}
// after - only request configuration when the client supports it
if s.clientCapabilities().Workspace?.Configuration == true {
resp, err = sendClientRequest(ctx, s, lsproto.WorkspaceConfigurationInfo, params)
} Defensive patterns
Strategy: validation
Validate before calling
// before sending any server->client request, check the capability
caps := s.clientCapabilities()
ok := caps.Workspace != nil && caps.Workspace.Configuration != nil && *caps.Workspace.Configuration
if !ok {
return defaults, nil // skip the request entirely
} Type guard
func canRequestConfiguration(caps *lsproto.ClientCapabilities) bool {
return caps.Workspace != nil &&
caps.Workspace.Configuration != nil &&
*caps.Workspace.Configuration
} Try / catch
resp, err := sendClientRequest(ctx, s, info, params)
if err != nil {
if strings.Contains(err.Error(), "request failed") {
// client refused; degrade to default behavior rather than failing the handler
return defaultValue, nil
}
return zero, err
} Prevention
- Gate every server-to-client request on advertised client capabilities from initialize
- Parse the embedded client error code to distinguish MethodNotFound (unsupported) from real failures
- Make optional client integrations non-fatal
When it happens
Trigger: Calling a client capability the client never declared (e.g. sending workspace/configuration to a client without configuration support); client-side handler throws (ServerNotInitialized, InvalidParams from the client); client returns MethodNotFound for an optional request; user closes a progress dialog the server tried to create.
Common situations: Server assumes a capability from initializeOptions that the editor did not advertise; older editor version lacking a newer LSP method; VS Code rejecting window/workDoneProgress/create after the item was already disposed.
Related errors
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/b4929cfa0baf2f43.
Report an issue: GitHub.