gravitational/teleport · error

err.Error()

Error message

err.Error()

What it means

writeError is the web UI's generic error writer: it maps the handler error to an HTTP status via trace.ErrorToCode and writes err.Error() as the plain-text body. The literal 'err.Error()' is the formatted message of whatever error the web handler returned.

Source

Thrown at lib/web/app/middleware.go:165

		}
	}
}

// makeHandler creates a http.HandlerFunc.
func makeHandler(handler handlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if err := handler(w, r); err != nil {
			writeError(w, err)
			return
		}
	}
}

// writeError gets the HTTP status code from trace and writes the error to the
// response writer.
func writeError(w http.ResponseWriter, err error) {
	code := trace.ErrorToCode(err)
	http.Error(w, err.Error(), code)
}

type routerFunc func(http.ResponseWriter, *http.Request, httprouter.Params) error

type routerAuthFunc func(http.ResponseWriter, *http.Request, httprouter.Params, *session) error

type handlerAuthFunc func(http.ResponseWriter, *http.Request, *session) error

type handlerFunc func(http.ResponseWriter, *http.Request) error

type launcherURLParams struct {
	// clusterName is the cluster within which this application is running.
	clusterName string
	// publicAddr is the public address of this application.
	publicAddr string
	// arn is the AWS role name, defined only when accessing AWS management console.
	arn string
	// stateToken if defined means initiating an app access auth exchange.

View on GitHub (pinned to 1283425b60)

Solutions

  1. Read the response body / web proxy logs to identify the underlying error
  2. Address the root cause per the HTTP status code (auth, bad request, not found, server error) and retry
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at lib/web/app/middleware.go:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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