{"record":{"id":"88b31356895c59b1","repo":"crowdsecurity/crowdsec","slug":"could-not-get-jwt-token-w","errorCode":null,"errorMessage":"could not get jwt token: %w","messagePattern":"could not get jwt token: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/auth_jwt.go","lineNumber":107,"sourceCode":"\t\t\twithBackOff:      true,\n\t\t\tretryStatusCodes: []int{http.StatusTooManyRequests, http.StatusServiceUnavailable, http.StatusGatewayTimeout, http.StatusInternalServerError},\n\t\t},\n\t}\n\n\tif t.UserAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", t.UserAgent)\n\t}\n\n\tif log.IsLevelEnabled(log.TraceLevel) {\n\t\tdump, _ := httputil.DumpRequest(req, true)\n\t\tlog.Tracef(\"auth-jwt request: %s\", string(dump))\n\t}\n\n\tlog.Debugf(\"auth-jwt(auth): %s %s\", req.Method, req.URL.String())\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get jwt token: %w\", err)\n\t}\n\n\tlog.Debugf(\"auth-jwt : http %d\", resp.StatusCode)\n\n\tif log.IsLevelEnabled(log.TraceLevel) {\n\t\tdump, _ := httputil.DumpResponse(resp, true)\n\t\tlog.Tracef(\"auth-jwt response: %s\", string(dump))\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tlog.Debugf(\"received response status %q when fetching %v\", resp.Status, req.URL)\n\n\t\terr = CheckResponse(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiclient/auth_jwt.go#L89-L125","documentation":"Returned by refreshJwtToken when the HTTP POST to the /watchers/login endpoint fails at the transport level (connection refused, timeout, DNS failure) while fetching a new JWT. Wraps the client.Do error; the server was never successfully reached.","triggerScenarios":"Thrown at pkg/apiclient/auth_jwt.go:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the LAPI URL and that lapi is listening","Check network connectivity, proxy and TLS certificates","Retry with backoff; the transport retries on transient errors already"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}