crowdsecurity/crowdsec · error

performing request

Error message

performing request: %w

What it means

AlertsService.List executed the HTTP request via client.Do; a transport-level failure (network error, timeout, non-decodable response) occurred, so the alerts listing fails with the wrapped client error while still returning the response.

Solutions

  1. Verify LAPI is running and reachable at the configured URL
  2. Check network/TLS configuration and certificates
  3. Retry; transient network issues may resolve
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/apiclient/alerts_service.go:93 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/7087e480db584e1a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/apiclient/alerts_service.go:93

	if err != nil {
		return nil, nil, fmt.Errorf("building query: %w", err)
	}

	URI := u
	if len(params) > 0 {
		URI = fmt.Sprintf("%s?%s", URI, params.Encode())
	}

	req, err := s.client.PrepareRequest(ctx, http.MethodGet, URI, nil)
	if err != nil {
		return nil, nil, fmt.Errorf("building request: %w", err)
	}

	alerts := models.GetAlertsResponse{}

	resp, err := s.client.Do(ctx, req, &alerts)
	if err != nil {
		return nil, resp, fmt.Errorf("performing request: %w", err)
	}

	return &alerts, resp, nil
}

// to demo query arguments
func (s *AlertsService) Delete(ctx context.Context, opts AlertsDeleteOpts) (*models.DeleteAlertsResponse, *Response, error) {
	params, err := qs.Values(opts)
	if err != nil {
		return nil, nil, err
	}

	u := fmt.Sprintf("%s/alerts?%s", s.client.URLPrefix, params.Encode())

	req, err := s.client.PrepareRequest(ctx, http.MethodDelete, u, nil)
	if err != nil {
		return nil, nil, err
	}

View on GitHub (pinned to 909b515798)