livekit/livekit · error

timed out while waiting for signal response

Error message

timed out while waiting for signal response

What it means

Returned by readInitialResponse when the timeout timer fires before the first SignalResponse arrives on the response source — the media/RTC side did not produce the initial join response within the allotted window. The request sink and response source are closed to avoid leaks.

Source

Thrown at pkg/service/rtcservice.go:785

	// instead of waiting forever on the WebSocket
	initialResponse, err := readInitialResponse(cr.ResponseSource, timeout)
	if err != nil {
		// close the connection to avoid leaking
		cr.RequestSink.Close()
		cr.ResponseSource.Close()
		return cr, nil, err
	}

	return cr, initialResponse, nil
}

func readInitialResponse(source routing.MessageSource, timeout time.Duration) (*livekit.SignalResponse, error) {
	responseTimer := time.NewTimer(timeout)
	defer responseTimer.Stop()
	for {
		select {
		case <-responseTimer.C:
			return nil, errors.New("timed out while waiting for signal response")
		case msg := <-source.ReadChan():
			if msg == nil {
				return nil, errors.New("connection closed by media")
			}
			res, ok := msg.(*livekit.SignalResponse)
			if !ok {
				return nil, fmt.Errorf("unexpected message type: %T", msg)
			}
			return res, nil
		}
	}
}

View on GitHub (pinned to ee45c3f0b1)

Solutions

  1. Retry the connection — transient media-node slowness is the usual cause
  2. Check media node health and load if timeouts persist
  3. Verify network connectivity between signal and media components
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/service/rtcservice.go:785 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of livekit/livekit@ee45c3f0b1 (2026-09-02). Data as JSON: /api/errors/542153d6cd3d01f5. Report an issue: GitHub.