Jackett/Jackett · error · Exception

Invalid response from AvistaZ, the response is not valid JSO

Error message

Invalid response from AvistaZ, the response is not valid JSON

What it means

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).

Source

Thrown at src/Jackett.Common/Indexers/Definitions/Abstract/AvistazTracker.cs:216

        protected async Task RenewalTokenAsync()
        {
            var body = new Dictionary<string, string>
            {
                { "username", configData.Username.Value.Trim() },
                { "password", configData.Password.Value.Trim() },
                { "pid", configData.Pid.Value.Trim() }
            };
            var result = await RequestWithCookiesAsync(AuthUrl, method: RequestType.POST, data: body, headers: AuthHeaders);

            if ((int)result.Status == 429)
            {
                throw new TooManyRequestsException("Rate limited", result);
            }

            if (!STJson.TryDeserialize<AvistazAuthResponse>(result.ContentString, out var authResponse))
            {
                throw new Exception("Invalid response from AvistaZ, the response is not valid JSON");
            }

            AuthorizationToken = authResponse.Token;

            if (AuthorizationToken == null)
            {
                throw new Exception(authResponse.Message ?? "Unauthorized request to indexer");
            }
        }

        protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
        {
            var releases = new List<ReleaseInfo>();

            var qc = GetSearchQueryParameters(query);
            var episodeSearchUrl = SearchUrl + "?" + qc.GetQueryString();

            var response = await RequestWithCookiesAndRetryAsync(episodeSearchUrl, headers: GetSearchHeaders());

View on GitHub (pinned to adff194147)

Solutions

  1. Capture and inspect response.ContentString to see what was actually returned.
  2. Verify AuthUrl and AuthHeaders are correct for the tracker.
  3. Handle Cloudflare (update Jackett / use Cloudflare solver) if an interstitial is returned.
Defensive patterns

Strategy: try-catch

Try / catch

try { await RenewalTokenAsync(); }
catch (Exception ex) when (ex.Message.Contains("not valid JSON"))
{ logger.Error($"Auth body was: {body}"); /* handle Cloudflare/HTML, do not retry as-is */ }

Prevention

When it happens

Trigger: Auth endpoint returns HTML (login/CAPTCHA page), an error page, or malformed JSON instead of the auth token payload.

Common situations: Cloudflare interstitial/JS challenge in front of auth; wrong AuthUrl; upstream maintenance page; credentials rejected with an HTML error.

Related errors


AI-assisted analysis of Jackett/Jackett@adff194147 (2026-08-13). Data as JSON: /api/errors/96ab6fa3d319c864. Report an issue: GitHub.