tonhowtf/omniget · warning

arquivo vazio

Error message

arquivo vazio

What it means

fetch_one() bails with "arquivo vazio" when the HTTP response succeeds (2xx) but the downloaded body has zero bytes. The library refuses to write empty image files, so a 200-with-empty-body (usually a broken CDN response or wrong content negotiation) surfaces as this error instead of silently creating a 0-byte image.

Solutions

  1. Retry the download — empty-200 responses are often transient CDN issues (and 429/5xx already retry internally, this case does not).
  2. Delete the partially-downloaded emote set and re-run to refresh URLs from the provider API.
  3. Check proxy/antivirus interference if many downloads come back empty.
  4. Verify the URL manually; if consistently empty, treat that emote as unavailable and skip it.
Defensive patterns

Strategy: retry

Try / catch

let mut attempt = 0;
loop {
    match emotes::run(&opts, &progress).await {
        Err(e) if e.to_string().contains("arquivo vazio") && attempt < 2 => {
            attempt += 1;
            tokio::time::sleep(Duration::from_secs(5 * attempt)).await;
        }
        other => break other,
    }
}

Prevention

When it happens

Trigger: Calling run() when an emote CDN returns HTTP 200 with an empty body: broken/empty CDN object, misconfigured proxy stripping the body, or a URL that responds 200 empty instead of 404 for deleted content.

Common situations: CDN edge serving stale empty objects; intercepting proxies/antivirus stripping bodies; provider changing image URLs so the old path now returns an empty 200.

Related errors


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

Appendix: source

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

        }
        let resp = match http.get(url).send().await {
            Ok(r) => r,
            Err(e) => {
                last = e.to_string();
                continue;
            }
        };
        let status = resp.status();
        if status.as_u16() == 429 || status.is_server_error() {
            last = format!("HTTP {}", status);
            continue;
        }
        if !status.is_success() {
            anyhow::bail!("HTTP {}", status);
        }
        let bytes = resp.bytes().await?;
        if bytes.is_empty() {
            anyhow::bail!("arquivo vazio");
        }
        std::fs::write(path, &bytes)?;
        return Ok(());
    }
    Err(anyhow!("{}", last))
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn le_emotes_e_badges_da_twitch() {
        let user = json!({
            "subscriptionProducts": [
                { "emotes": [
                    { "id": "emotesv2_abc", "token": "xqcSlam", "assetType": "ANIMATED" },
                    { "id": "305535174", "token": "xqcOmega", "assetType": "STATIC" }

View on GitHub (pinned to 8600b91f42)