tonhowtf/omniget · error · anyhow

o Trakt está limitando o acesso

Error message

o Trakt está limitando o acesso (HTTP {})

What it means

After 5 attempts (attempt == 4) of receiving HTTP 429 or any 5xx from Trakt, get_page gives up and reports the limiting status. The library already honored Retry-After headers with exponential backoff between attempts, so this error means the API stayed rate-limited or unavailable through all retries.

Solutions

  1. Increase opts.delay_ms passed to Api::new to space out requests
  2. Retry the export later — Trakt rate-limit windows reset every 5 minutes
  3. Reduce the number of lists/pages fetched per run (opts.max_pages, fewer lists in want)
  4. Check https://status.trakt.tv or the API for an ongoing incident
  5. Upgrade to VIP for higher rate limits

Example fix

// before
let api = Api::new(&c, 0)?;
// after
let api = Api::new(&c, 1500)?; // at least ~1.5s between calls
Defensive patterns

Strategy: retry

Validate before calling

// before running, ensure a conservative delay
assert!(opts.delay_ms >= 1000, "increase delay_ms to respect Trakt rate limits");

Try / catch

if let Err(e) = trakt_lists::run(&opts, &progress) {
    if e.to_string().contains("limitando o acesso") {
        tokio::time::sleep(Duration::from_secs(300)).await; // wait out the 5-min window
        // then retry with a larger delay_ms
    }
}

Prevention

When it happens

Trigger: get_page (via get_all) gets 429 Too Many Requests or a 5xx server error on every one of its 5 attempts despite Retry-After backoff (wait doubling each retry).

Common situations: Bulk export of many lists in a tight loop exceeding Trakt's per-5-minute call budget; Trakt outage or degraded API; opts.delay_ms set too low for the account tier.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/7eee026de9ba952b. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/lists/trakt.rs:499

                    "o Trakt recusou o token (401). Reconecte a conta no botão acima"
                ));
            }
            if status.as_u16() == 426 {
                return Err(anyhow!("esse recurso é só para contas VIP do Trakt"));
            }
            if status.as_u16() == 420 {
                return Err(anyhow!(
                    "a conta do Trakt bateu no limite do plano gratuito (HTTP 420)"
                ));
            }
            if status.as_u16() == 423 {
                return Err(anyhow!(
                    "a conta do Trakt está bloqueada; fale com o suporte deles"
                ));
            }
            if status.as_u16() == 429 || status.is_server_error() {
                if attempt == 4 {
                    return Err(anyhow!("o Trakt está limitando o acesso (HTTP {})", status));
                }
                let retry = r
                    .headers()
                    .get(reqwest::header::RETRY_AFTER)
                    .and_then(|v| v.to_str().ok())
                    .and_then(|v| v.trim().parse::<u64>().ok())
                    .map(Duration::from_secs);
                tokio::time::sleep(retry.unwrap_or(wait)).await;
                wait *= 2;
                continue;
            }
            if !status.is_success() {
                return Err(anyhow!("HTTP {} em {}", status, url));
            }
            let pages = r
                .headers()
                .get("x-pagination-page-count")
                .and_then(|v| v.to_str().ok())

View on GitHub (pinned to 8600b91f42)