tonhowtf/omniget · error · anyhow

não consegui ler

Error message

não consegui ler {}

What it means

This is the fallthrough at the end of get_page: if all retry attempts are exhausted without reaching a success or a specific error branch, the function reports it could not read the URL. It also covers the case where retries looped until attempts ran out on ambiguous failures.

Solutions

  1. Check network connectivity/DNS to api.trakt.tv (curl -v the URL from the message)
  2. Increase max_pages/scope down the request and retry the export later
  3. Ensure no proxy/firewall intercepts HTTPS to api.trakt.tv
  4. Retry after the transient Trakt incident passes — the tool already retries 5 times with exponential backoff
Defensive patterns

Strategy: retry

Validate before calling

// reachability preflight
if reqwest::get("https://api.trakt.tv/").await.is_err() { return Err("Trakt unreachable"); }

Try / catch

for attempt in 0..3 {
    match trakt_lists::run(&opts, &progress) {
        Err(e) if e.to_string().contains("não consegui ler") => {
            tokio::time::sleep(Duration::from_secs(30 * (attempt + 1))).await;
        }
        other => { other?; break; }
    }
}

Prevention

When it happens

Trigger: get_page (via get_all) exhausts its retry attempts (timeouts, connection errors, or persistent non-success statuses that never hit the earlier branches) and returns this final error for the given URL.

Common situations: Flaky network or proxy blocking api.trakt.tv; long outage causing all 5 attempts to fail; TLS/DNS issues on the host machine; very long Retry-After values making backoff insufficient.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

                    .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())
                .and_then(|v| v.trim().parse::<u32>().ok())
                .unwrap_or(1);
            let v: Value = r.json().await?;
            return Ok((v, pages.max(1)));
        }
        Err(anyhow!("não consegui ler {}", url))
    }

    /// Percorre todas as páginas até o teto pedido.
    async fn get_all(
        &self,
        path: &str,
        max_pages: u32,
        p: &ProgressFn,
        what: &str,
    ) -> Result<Vec<Value>> {
        let mut out = Vec::new();
        let mut page = 1u32;
        loop {
            let (v, pages) = self.get_page(path, page, 100).await?;
            let total = pages.min(max_pages.max(1));
            report(
                p,
                TOOL_ID,

View on GitHub (pinned to 8600b91f42)