crowdsecurity/crowdsec · error

performing jwt auth: %w

Error message

performing jwt auth: %w

What it means

JWTTransport.RoundTrip executed the authenticated request after token preparation; a transport-level failure occurred (network error, timeout), so the token is reset (forcing re-auth) and the error is wrapped and returned.

Source

Thrown at pkg/apiclient/auth_jwt.go:210

	for {
		if log.IsLevelEnabled(log.TraceLevel) {
			// requestToDump := cloneRequest(req)
			dump, _ := httputil.DumpRequest(req, true)
			log.Tracef("req-jwt: %s", string(dump))
		}
		// Make the HTTP request.
		clonedReq := cloneRequest(req)

		clonedReq, err := t.prepareRequest(clonedReq)
		if err != nil {
			return nil, err
		}

		resp, err = t.transport().RoundTrip(clonedReq)
		if err != nil {
			// we had an error (network error for example), reset the token?
			t.ResetToken()
			return resp, fmt.Errorf("performing jwt auth: %w", err)
		}

		if resp != nil {
			log.Debugf("resp-jwt: %d", resp.StatusCode)
		}

		config, shouldRetry := t.RetryConfig.StatusCodeConfig[resp.StatusCode]
		if !shouldRetry {
			break
		}

		if attemptsCount[resp.StatusCode] >= config.MaxAttempts {
			log.Infof("max attempts reached for status code %d", resp.StatusCode)
			break
		}

		if config.InvalidateToken {
			log.Debugf("invalidating token for status code %d", resp.StatusCode)

View on GitHub (pinned to 909b515798)

Solutions

  1. Check connectivity to the LAPI
  2. Inspect the wrapped transport error for root cause
  3. Retry; token reset forces fresh authentication on next attempt
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/apiclient/auth_jwt.go:210 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/4d4f57ac3441b12c. Report an issue: GitHub.