{"record":{"id":"fb188e408c317691","repo":"crowdsecurity/crowdsec","slug":"unable-to-decode-response-w","errorCode":null,"errorMessage":"unable to decode response: %w","messagePattern":"unable to decode response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/auth_jwt.go","lineNumber":131,"sourceCode":"\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}\n\t}\n\n\tvar response models.WatcherAuthResponse\n\n\tif err := json.NewDecoder(resp.Body).Decode(&response); err != nil {\n\t\treturn fmt.Errorf(\"unable to decode response: %w\", err)\n\t}\n\n\tif err := t.Expiration.UnmarshalText([]byte(response.Expire)); err != nil {\n\t\treturn fmt.Errorf(\"unable to parse jwt expiration: %w\", err)\n\t}\n\n\tt.Token = response.Token\n\n\tif t.TokenSave != nil {\n\t\terr = t.TokenSave(ctx, t.Token)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to save token: %s\", err)\n\t\t}\n\t}\n\n\tlog.Debugf(\"token %s will expire on %s\", t.Token, t.Expiration.String())\n\n\tselect {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiclient/auth_jwt.go#L113-L149","documentation":"Returned by refreshJwtToken when the successful (2xx) login response body is not valid JSON or does not match the WatcherAuthResponse shape, so the returned token cannot be extracted. Wraps the json.Decoder error while reading the response body.","triggerScenarios":"Thrown at pkg/apiclient/auth_jwt.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the endpoint is a crowdsec LAPI (no proxy/error page in between)","Check LAPI version compatibility","Inspect LAPI logs for the corresponding login request"],"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-14T00:17:10.932Z"}