{"record":{"id":"4db94fa66b80327f","repo":"tonhowtf/omniget","slug":"fxtwitter-limite-de-requisicoes-atingido-tente-de-novo-em","errorCode":null,"errorMessage":"FxTwitter: limite de requisicoes atingido, tente de novo em instantes","messagePattern":"FxTwitter: limite de requisicoes atingido, tente de novo em instantes","errorType":"exception","errorClass":null,"httpStatus":429,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/tools/x/fx.rs","lineNumber":58,"sourceCode":"    }\n    let resp = req.send().await?;\n    let status = resp.status();\n    let body: Value = resp\n        .json()\n        .await\n        .map_err(|e| anyhow!(\"FxTwitter: resposta invalida ({})\", e))?;\n    let code = body\n        .get(\"code\")\n        .and_then(|c| c.as_u64())\n        .unwrap_or(status.as_u16() as u64);\n    if code == 404 {\n        return Err(anyhow!(\"nao encontrado no X (ou o post e privado)\"));\n    }\n    if code == 401 {\n        return Err(anyhow!(\"post ou perfil privado\"));\n    }\n    if code == 429 {\n        return Err(anyhow!(\n            \"FxTwitter: limite de requisicoes atingido, tente de novo em instantes\"\n        ));\n    }\n    if code >= 400 {\n        let msg = body\n            .get(\"message\")\n            .and_then(|m| m.as_str())\n            .unwrap_or(\"erro\");\n        return Err(anyhow!(\"FxTwitter: {} ({})\", msg, code));\n    }\n    Ok(body)\n}\n\nfn s(v: &Value, k: &str) -> String {\n    v.get(k).and_then(|x| x.as_str()).unwrap_or(\"\").to_string()\n}\n\nfn n(v: &Value, k: &str) -> u64 {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/x/fx.rs#L40-L76","documentation":"FxTwitter returned code 429, meaning the rate limit for the shared FxTwitter service was exhausted. fx.rs surfaces a retry-hint message because the limit belongs to the public shared API, not this client's own quota.","triggerScenarios":"Bursting many get()-backed calls (status, thread, conversation, profile, profile_statuses, profile_media) in a short window, especially when scraping many IDs or polling in a loop.","commonSituations":"Bulk downloads of media from many posts; a retry loop without backoff hammering the endpoint after earlier failures; multiple users of the shared FxTwitter API exhausting its global quota.","solutions":["Wait and retry with exponential backoff and jitter.","Add caching/deduplication so the same post or profile is fetched only once per run.","Throttle request rate (e.g. limit concurrency to 1-2 and add delay between calls).","Fall back to the authenticated native X client when FxTwitter is rate-limited."],"exampleFix":"// before\nfor id in ids {\n    let post = fx::status(&id).await?;\n}\n// after\nfor id in ids {\n    let post = loop {\n        match fx::status(&id).await {\n            Ok(p) => break p,\n            Err(e) if e.to_string().contains(\"limite de requisicoes\") => {\n                tokio::time::sleep(Duration::from_secs(backoff)).await;\n                backoff = (backoff * 2).min(60);\n            }\n            Err(e) => return Err(e),\n        }\n    };\n    tokio::time::sleep(Duration::from_millis(500)).await;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async fn with_retry<T>(f: impl Fn() -> impl Future<Output = anyhow::Result<T>>) -> anyhow::Result<T> {\n    let mut delay = Duration::from_secs(2);\n    loop {\n        match f().await {\n            Ok(v) => return Ok(v),\n            Err(e) if e.to_string().contains(\"limite de requisicoes\") && delay <= Duration::from_secs(60) => {\n                tokio::time::sleep(delay).await;\n                delay *= 2;\n            }\n            Err(e) => return Err(e),\n        }\n    }\n}","preventionTips":["Add exponential backoff with jitter on 429-style errors","Cache FxTwitter responses so repeated IDs are fetched once","Limit concurrency and pace requests (e.g. >=500ms between calls)","Prefer the authenticated native client for bulk operations"],"tags":["fxtwitter","rate-limit","retry","http-429"],"backgroundTag":"rate-limit-exceeded","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"}