microsoft/typescript-go · error · jsonrpc.ResponseError

-32603

-32603

Error message

panic: %v\n%s

What it means

The synchronous connection's request dispatcher recovers panics from handlers and converts them into a JSON-RPC error response with code -32603, including the panic value and Go stack trace — the SyncConn twin of the async path (error 94).

Source

Thrown at internal/api/conn_sync.go:121

		if writeErr != nil {
			panic(fmt.Sprintf("api: failed to write reset server timing response: %v", writeErr))
		}
		return
	}

	var result any
	var err error

	start := time.Time{}
	if c.timing != nil {
		start = time.Now()
	}

	// Recover from panics and convert to error response with stack trace
	defer func() {
		if r := recover(); r != nil {
			stack := string(debug.Stack())
			err = fmt.Errorf("panic: %v\n%s", r, stack)

			c.mu.Lock()
			writeErr := c.protocol.WriteError(msg.ID, &jsonrpc.ResponseError{
				Code:    jsonrpc.CodeInternalError,
				Message: err.Error(),
			})
			c.mu.Unlock()

			if writeErr != nil {
				panic(fmt.Sprintf("api: failed to write panic error response: %v (original panic: %v)", writeErr, r))
			}
		}
	}()

	result, err = c.handler.HandleRequest(ctx, msg.Method, msg.Params)

	if c.timing != nil {
		c.timing.record(msg.Method, time.Since(start))

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Locate the fault using the embedded stack trace and report or patch it
  2. Update to a fixed server build
  3. Avoid the triggering request/params until fixed
  4. Check server stderr for preceding warnings that hint at the root cause
Defensive patterns

Strategy: try-catch

Try / catch

result, err := conn.Call(ctx, method, params)
if err != nil && strings.Contains(err.Error(), "panic:") {
    // internal server panic surfaced as -32603: capture stack from message, update/report
}

Prevention

When it happens

Trigger: Any panic while dispatching a request in the sync server loop: nil map/slice access, assertion failures, invariant violations in a method implementation.

Common situations: Server regressions after upgrades, malformed params that pass parsing but break assumptions, uninitialized optional components (timing, FS callbacks).

Related errors


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