{"record":{"id":"e47ee0d9c4ebdb58","repo":"crowdsecurity/crowdsec","slug":"parsing-api-url-s-w","errorCode":null,"errorMessage":"parsing api url ('%s'): %w","messagePattern":"parsing api url \\('(.+?)'\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/client.go","lineNumber":102,"sourceCode":"\t\treturn subscriptionType\n\t}\n\n\treturn \"\"\n}\n\nfunc (c *ApiClient) GetTokenRefreshChan() chan struct{} {\n\tjwtTransport := c.client.Transport.(*JWTTransport)\n\treturn jwtTransport.TokenRefreshChan\n}\n\ntype service struct {\n\tclient *ApiClient\n}\n\nfunc InitLAPIClient(ctx context.Context, apiUrl string, papiUrl string, login string, password string, scenarios []string) error {\n\tapiURL, err := url.Parse(apiUrl)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing api url ('%s'): %w\", apiURL, err)\n\t}\n\n\tpapiURL, err := url.Parse(papiUrl)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing polling api url ('%s'): %w\", papiURL, err)\n\t}\n\n\tpwd := strfmt.Password(password)\n\n\tclient := NewClient(&Config{\n\t\tMachineID:     login,\n\t\tPassword:      pwd,\n\t\tURL:           apiURL,\n\t\tPapiURL:       papiURL,\n\t\tVersionPrefix: \"v1\",\n\t\tUpdateScenario: func(_ context.Context) ([]string, error) {\n\t\t\treturn scenarios, nil\n\t\t},","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiclient/client.go#L84-L120","documentation":"Returned by InitLAPIClient when the configured Local API URL string cannot be parsed by net/url — e.g. missing scheme or malformed host. The offending input is the api_url configuration value, named in the message.","triggerScenarios":"Thrown at pkg/apiclient/client.go:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix api_url in config.yaml (e.g. http://127.0.0.1:8080/)","Check for typos, missing scheme, or stray characters"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}