crowdsecurity/crowdsec · error
parsing polling api url ('%s'): %w
Error message
parsing polling api url ('%s'): %w What it means
Returned by InitLAPIClient when the configured polling API URL string cannot be parsed by net/url. The offending input is the polling api_url configuration value (often the CAPI URL), named in the message.
Source
Thrown at pkg/apiclient/client.go:107
func (c *ApiClient) GetTokenRefreshChan() chan struct{} {
jwtTransport := c.client.Transport.(*JWTTransport)
return jwtTransport.TokenRefreshChan
}
type service struct {
client *ApiClient
}
func InitLAPIClient(ctx context.Context, apiUrl string, papiUrl string, login string, password string, scenarios []string) error {
apiURL, err := url.Parse(apiUrl)
if err != nil {
return fmt.Errorf("parsing api url ('%s'): %w", apiURL, err)
}
papiURL, err := url.Parse(papiUrl)
if err != nil {
return fmt.Errorf("parsing polling api url ('%s'): %w", papiURL, err)
}
pwd := strfmt.Password(password)
client := NewClient(&Config{
MachineID: login,
Password: pwd,
URL: apiURL,
PapiURL: papiURL,
VersionPrefix: "v1",
UpdateScenario: func(_ context.Context) ([]string, error) {
return scenarios, nil
},
})
authResp, _, err := client.Auth.AuthenticateWatcher(ctx, models.WatcherAuthRequest{
MachineID: &login,
Password: &pwd,View on GitHub (pinned to 909b515798)
Solutions
- Fix the polling api URL in the crowdsec configuration
- Ensure it is a valid absolute URL with scheme
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/apiclient/client.go:107 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/ada2114c0e0801c0.
Report an issue: GitHub.