{"record":{"id":"96ab6fa3d319c864","repo":"Jackett/Jackett","slug":"invalid-response-from-avistaz-the-response-is-not","errorCode":null,"errorMessage":"Invalid response from AvistaZ, the response is not valid JSON","messagePattern":"Invalid response from AvistaZ, the response is not valid JSON","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Jackett.Common/Indexers/Definitions/Abstract/AvistazTracker.cs","lineNumber":216,"sourceCode":"\n        protected async Task RenewalTokenAsync()\n        {\n            var body = new Dictionary<string, string>\n            {\n                { \"username\", configData.Username.Value.Trim() },\n                { \"password\", configData.Password.Value.Trim() },\n                { \"pid\", configData.Pid.Value.Trim() }\n            };\n            var result = await RequestWithCookiesAsync(AuthUrl, method: RequestType.POST, data: body, headers: AuthHeaders);\n\n            if ((int)result.Status == 429)\n            {\n                throw new TooManyRequestsException(\"Rate limited\", result);\n            }\n\n            if (!STJson.TryDeserialize<AvistazAuthResponse>(result.ContentString, out var authResponse))\n            {\n                throw new Exception(\"Invalid response from AvistaZ, the response is not valid JSON\");\n            }\n\n            AuthorizationToken = authResponse.Token;\n\n            if (AuthorizationToken == null)\n            {\n                throw new Exception(authResponse.Message ?? \"Unauthorized request to indexer\");\n            }\n        }\n\n        protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)\n        {\n            var releases = new List<ReleaseInfo>();\n\n            var qc = GetSearchQueryParameters(query);\n            var episodeSearchUrl = SearchUrl + \"?\" + qc.GetQueryString();\n\n            var response = await RequestWithCookiesAndRetryAsync(episodeSearchUrl, headers: GetSearchHeaders());","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/Jackett/Jackett/blob/adff1941476d8057a430cf55360356c1d23e971e/src/Jackett.Common/Indexers/Definitions/Abstract/AvistazTracker.cs#L198-L234","documentation":"After a non-429 auth response, RenewalTokenAsync tries STJson.TryDeserialize<AvistazAuthResponse>. If deserialization fails it throws \"Invalid response from AvistaZ, the response is not valid JSON\". This means the body was not the expected JSON shape (HTML login page, gateway error, empty body).","triggerScenarios":"Auth endpoint returns HTML (login/CAPTCHA page), an error page, or malformed JSON instead of the auth token payload.","commonSituations":"Cloudflare interstitial/JS challenge in front of auth; wrong AuthUrl; upstream maintenance page; credentials rejected with an HTML error.","solutions":["Capture and inspect response.ContentString to see what was actually returned.","Verify AuthUrl and AuthHeaders are correct for the tracker.","Handle Cloudflare (update Jackett / use Cloudflare solver) if an interstitial is returned."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await RenewalTokenAsync(); }\ncatch (Exception ex) when (ex.Message.Contains(\"not valid JSON\"))\n{ logger.Error($\"Auth body was: {body}\"); /* handle Cloudflare/HTML, do not retry as-is */ }","preventionTips":["Inspect the raw auth body before assuming bad credentials.","Detect HTML/Cloudflare interstitials and surface a distinct error.","Verify AuthUrl and headers match the current API."],"tags":["auth","json","parsing","indexer","csharp","jackett"],"backgroundTag":null,"analyzedSha":"adff1941476d8057a430cf55360356c1d23e971e","analyzedAt":"2026-08-13T15:06:32.872Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}