microsoft/typescript-go · info

failed to refresh inlay hints: %w

Error message

failed to refresh inlay hints: %w

What it means

RefreshInlayHints (server.go:346-355): the client advertised workspace.inlayHint.refreshSupport, but queueing the fire-and-forget workspace/inlayHint/refresh request failed locally (sendClientRequestFireAndForget -> s.send -> outgoingQueue.Put). As with diagnostics refresh, client responses are ignored; this error means the outgoing channel/writer rejected the message.

Source

Thrown at internal/lsp/server.go:352

	if !s.telemetryEnabled {
		panic("SendTelemetry called with telemetry disabled")
	}
	return sendNotification(s, lsproto.TelemetryEventInfo, telemetry)
}

// IsActive implements project.Client.
func (s *Server) IsActive() bool {
	last := s.lastRequestTimeMs.Load()
	return last == 0 || time.Since(time.UnixMilli(last)) <= time.Minute
}

func (s *Server) RefreshInlayHints(ctx context.Context) error {
	if !s.clientCapabilities.Workspace.InlayHint.RefreshSupport {
		return nil
	}

	if err := sendClientRequestFireAndForget(s, lsproto.WorkspaceInlayHintRefreshInfo, lsproto.NoParams{}); err != nil {
		return fmt.Errorf("failed to refresh inlay hints: %w", err)
	}
	return nil
}

func (s *Server) RefreshCodeLens(ctx context.Context) error {
	if !s.clientCapabilities.Workspace.CodeLens.RefreshSupport {
		return nil
	}

	if err := sendClientRequestFireAndForget(s, lsproto.WorkspaceCodeLensRefreshInfo, lsproto.NoParams{}); err != nil {
		return fmt.Errorf("failed to refresh code lens: %w", err)
	}
	return nil
}

// ProgressStart implements project.Client.
func (s *Server) ProgressStart(message *diagnostics.Message, args ...any) {
	if s.projectProgress != nil {

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Ignore during shutdown: if the background context is canceled, drop the refresh silently.
  2. Verify the writer/stream is healthy if this occurs mid-session; a broken outgoing queue usually surfaces elsewhere too.
  3. Call RefreshInlayHints only when capabilities advertise refreshSupport (the method already checks, but your layer should too) and treat its error as advisory.

Example fix

// before
if err := client.RefreshInlayHints(ctx); err != nil { return err }
// after
_ = client.RefreshInlayHints(ctx) // advisory; failure is non-fatal
Defensive patterns

Strategy: try-catch

Validate before calling

if clientCaps.Workspace.InlayHint.RefreshSupport && ctx.Err() == nil {
    if err := client.RefreshInlayHints(ctx); err != nil {
        log.Printf("inlay hint refresh skipped: %v", err)
    }
}

Type guard

func inlayRefreshSafe(caps lsproto.ResolvedClientCapabilities, ctx context.Context) bool {
    return caps.Workspace.InlayHint.RefreshSupport && ctx.Err() == nil
}

Try / catch

if err := client.RefreshInlayHints(ctx); err != nil {
    if ctx.Err() != nil {
        return nil // shutting down; outgoing queue closed
    }
    log.Printf("inlay refresh skipped: %v", err)
}

Prevention

When it happens

Trigger: Outgoing queue closed during server teardown, writer already failed, or background context canceled — typically when a configuration change triggers an inlay-hint refresh concurrently with shutdown or a crashed writer.

Common situations: Editor closing during a config-change-triggered refresh; test harnesses ending sessions before queued refreshes flush; a prior write error having poisoned the writer.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/9cb3e4adafe47b98. Report an issue: GitHub.