tonhowtf/omniget · error

respondeu HTTP

Error message

{} respondeu HTTP {}

What it means

json_get() in emotes.rs is a helper that GETs a URL and bails when the HTTP response status is not a success (2xx). It reports the URL and the exact status code. This is how the emote provider layer surfaces non-200 responses (404, 403, 429, 5xx) from upstream JSON APIs (Twitch GQL, 7TV, BTTV, FFZ endpoints).

Solutions

  1. Read the URL and status in the message; check the provider's status page and whether the endpoint moved.
  2. Ensure valid Twitch credentials/GQL setup where the endpoint requires auth.
  3. Add backoff/retry for 429/5xx responses before re-running.
  4. Update the tool to the latest version so provider endpoint definitions are current.
Defensive patterns

Strategy: retry

Validate before calling

// before calling run(), check network reachability of the provider endpoint:
let status = reqwest::get("https://7tv.io/v3/emote-sets/global").await?.status();
if !status.is_success() { eprintln!("provedor indisponível: {}", status); }

Try / catch

match emotes::run(&opts, &progress).await {
    Err(e) if e.to_string().contains("respondeu HTTP 429") => {
        tokio::time::sleep(Duration::from_secs(30)).await;
        emotes::run(&opts, &progress).await?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling run() or live_provedores_de_emote_respondem when any upstream emote-provider JSON endpoint returns a non-success status: expired/invalid Twitch auth for GQL, wrong or removed provider URL, rate limiting (429), or provider outage (5xx).

Common situations: Twitch requiring authentication for GQL client credentials; a provider API changing its endpoint path in a newer version; hammering the API and hitting 429; corporate proxy returning 403/502 HTML pages.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/twitch/emotes.rs:523

        ch = html_escape(channel),
        n = items.len(),
        cards = cards
    )
}

fn html_escape(s: &str) -> String {
    s.replace('&', "&")
        .replace('<', "&lt;")
        .replace('>', "&gt;")
        .replace('"', "&quot;")
}

// ───────────────────────── coleta e download ─────────────────────────

async fn json_get(http: &reqwest::Client, url: &str) -> anyhow::Result<Value> {
    let resp = http.get(url).send().await?;
    if !resp.status().is_success() {
        anyhow::bail!("{} respondeu HTTP {}", url, resp.status());
    }
    Ok(resp.json::<Value>().await?)
}

pub async fn run(opts: &Options, p: &ProgressFn) -> anyhow::Result<Result> {
    let gql = Gql::new()?;
    let http = super::super::client()?;

    let login = if opts.channel.trim().is_empty() {
        None
    } else {
        Some(
            super::gql::parse_channel(&opts.channel)
                .ok_or_else(|| anyhow!("não reconheci esse canal: {}", opts.channel))?,
        )
    };

    report(p, ID, "progress", 0, None, Some("lendo o canal".into()));

View on GitHub (pinned to 8600b91f42)