gravitational/teleport · error

Internal Server Error

Error message

Internal Server Error

What it means

ConnectionsLimiter.ServeHTTP writes a plain 'Internal Server Error' (http.StatusText of 500) when it is asked to serve a request but no wrapped handler was configured via Wrap — a misconfigured/misused limiter, not a client-visible runtime condition.

Source

Thrown at lib/limiter/connlimiter.go:63

// maxConnections is zero, the limiter performs no tracking and
// all requests pass through.
func NewConnectionsLimiter(maxConnections int64) *ConnectionsLimiter {
	return &ConnectionsLimiter{
		maxConnections: maxConnections,
		log:            slog.With(teleport.ComponentKey, "limiter"),
		connections:    make(map[string]int64),
	}
}

// Wrap wraps an HTTP handler.
func (l *ConnectionsLimiter) Wrap(h http.Handler) {
	l.next = h
}

func (l *ConnectionsLimiter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if l.next == nil {
		sc := http.StatusInternalServerError
		http.Error(w, http.StatusText(sc), sc)
		return
	}

	if l.maxConnections == 0 {
		l.next.ServeHTTP(w, r)
		return
	}

	clientIP, err := ratelimit.ExtractClientIP(r)
	if err != nil {
		l.log.WarnContext(context.Background(), "failed to extract source IP", "remote_addr", r.RemoteAddr)
		ratelimit.ServeHTTPError(w, r, err)
		return
	}

	if err := l.AcquireConnection(clientIP); err != nil {
		l.log.InfoContext(context.Background(), "limiting request", "token", clientIP, "error", err)
		w.WriteHeader(http.StatusTooManyRequests)

View on GitHub (pinned to 1283425b60)

Solutions

  1. Ensure the ConnectionsLimiter is wired with a next handler via Wrap before serving
  2. Check the code path that constructs the limiter middleware chain
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/limiter/connlimiter.go:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02). Data as JSON: /api/errors/09546e3a3901a4f3. Report an issue: GitHub.