{"record":{"id":"b04d01c0dbfdcf47","repo":"tonhowtf/omniget","slug":"arquivo-vazio","errorCode":null,"errorMessage":"arquivo vazio","messagePattern":"arquivo vazio","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/tools/twitch/emotes.rs","lineNumber":834,"sourceCode":"        }\n        let resp = match http.get(url).send().await {\n            Ok(r) => r,\n            Err(e) => {\n                last = e.to_string();\n                continue;\n            }\n        };\n        let status = resp.status();\n        if status.as_u16() == 429 || status.is_server_error() {\n            last = format!(\"HTTP {}\", status);\n            continue;\n        }\n        if !status.is_success() {\n            anyhow::bail!(\"HTTP {}\", status);\n        }\n        let bytes = resp.bytes().await?;\n        if bytes.is_empty() {\n            anyhow::bail!(\"arquivo vazio\");\n        }\n        std::fs::write(path, &bytes)?;\n        return Ok(());\n    }\n    Err(anyhow!(\"{}\", last))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn le_emotes_e_badges_da_twitch() {\n        let user = json!({\n            \"subscriptionProducts\": [\n                { \"emotes\": [\n                    { \"id\": \"emotesv2_abc\", \"token\": \"xqcSlam\", \"assetType\": \"ANIMATED\" },\n                    { \"id\": \"305535174\", \"token\": \"xqcOmega\", \"assetType\": \"STATIC\" }","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/twitch/emotes.rs#L816-L852","documentation":"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.","triggerScenarios":"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.","commonSituations":"CDN edge serving stale empty objects; intercepting proxies/antivirus stripping bodies; provider changing image URLs so the old path now returns an empty 200.","solutions":["Retry the download — empty-200 responses are often transient CDN issues (and 429/5xx already retry internally, this case does not).","Delete the partially-downloaded emote set and re-run to refresh URLs from the provider API.","Check proxy/antivirus interference if many downloads come back empty.","Verify the URL manually; if consistently empty, treat that emote as unavailable and skip it."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let mut attempt = 0;\nloop {\n    match emotes::run(&opts, &progress).await {\n        Err(e) if e.to_string().contains(\"arquivo vazio\") && attempt < 2 => {\n            attempt += 1;\n            tokio::time::sleep(Duration::from_secs(5 * attempt)).await;\n        }\n        other => break other,\n    }\n}","preventionTips":["Retry empty-body downloads after a short delay — the tool only auto-retries 429/5xx, not empty 200s.","Check proxy/antivirus software that can strip response bodies.","Re-fetch emote URLs from the provider API rather than reusing cached ones.","Verify downloaded files are non-empty and valid images before use."],"tags":["twitch","emotes","download","empty-body"],"backgroundTag":"empty-response-body","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}