{"record":{"id":"a934c068da10c79f","repo":"tonhowtf/omniget","slug":"o-reddit-barrou-o-acesso-p-blico-403-costuma-ser-bloqueio-de","errorCode":null,"errorMessage":"o Reddit barrou o acesso público (403). Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão","messagePattern":"o Reddit barrou o acesso público \\(403\\)\\. Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/mod.rs","lineNumber":449,"sourceCode":"                }\n                Ok(r) if r.status().as_u16() == 429 || r.status().is_server_error() => {\n                    if attempt == TRIES {\n                        return Err(anyhow!(\n                            \"o Reddit está limitando o acesso (HTTP {}). Tente de novo daqui a pouco\",\n                            r.status()\n                        ));\n                    }\n                    let retry = r\n                        .headers()\n                        .get(reqwest::header::RETRY_AFTER)\n                        .and_then(|v| v.to_str().ok())\n                        .and_then(|v| v.trim().parse::<u64>().ok())\n                        .map(Duration::from_secs);\n                    tokio::time::sleep(retry.unwrap_or(wait)).await;\n                    wait *= 2;\n                }\n                Ok(r) if r.status().as_u16() == 403 => {\n                    return Err(anyhow!(\n                        \"o Reddit barrou o acesso público (403). Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão\"\n                    ));\n                }\n                Ok(r) if r.status().as_u16() == 404 => {\n                    return Err(anyhow!(\n                        \"post não encontrado (apagado, privado ou id errado)\"\n                    ));\n                }\n                Ok(r) => {\n                    return Err(anyhow!(\"HTTP {} em {}\", r.status(), url));\n                }\n                Err(e) if attempt < TRIES => {\n                    tokio::time::sleep(wait).await;\n                    wait *= 2;\n                    let _ = e;\n                }\n                Err(e) => return Err(e.into()),\n            }","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/mod.rs#L431-L467","documentation":"Reddit responds with HTTP 403 Forbidden when public, unauthenticated access is blocked. `get_json` maps that status directly to this message because it usually means network-level blocking or restricted content, not a bug in the caller. Unlike 404, retrying will not help — the access path itself is denied.","triggerScenarios":"Any `get_json` call where Reddit returns 403: requests from cloud/datacenter IPs or known VPN ranges, requests without an accepted User-Agent, or content that requires login/age verification.","commonSituations":"Running on a cloud VM whose IP range Reddit blocks; corporate firewall or country-level blocking of reddit.com; accessing quarantined/NSFW/subscriber-only content while unauthenticated; missing or bot-like User-Agent header.","solutions":["Switch network/connection (different IP, no VPN, or residential connection)","Set a descriptive, browser-like User-Agent header on requests","If content is restricted (private/quarantined sub), authenticate via OAuth instead of public endpoints","Check whether a corporate firewall or DNS filter is blocking reddit.com"],"exampleFix":"// before\nlet client = reqwest::Client::new(); // default UA, often blocked\n// after\nlet client = reqwest::Client::builder()\n    .user_agent(\"web:myapp:v1.0 (by /u/myuser)\")\n    .build()?;","handlingStrategy":"fallback","validationCode":"// pre-flight reachability check from this network\nlet probe = client.get(\"https://www.reddit.com/r/popular.json\")\n    .header(\"User-Agent\", UA).send().await?;\nif probe.status() == reqwest::StatusCode::FORBIDDEN {\n    eprintln!(\"This network/IP appears blocked by Reddit — switch connection\");\n}","typeGuard":null,"tryCatchPattern":"match client.get_json(url).await {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"barrou o acesso\") => {\n        eprintln!(\"403: blocked — retrying via alternate endpoint/proxy or failing gracefully\");\n        fetch_via_fallback(url).await.unwrap_or_default()\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Don't run bulk scraping from datacenter/VPN IP ranges Reddit blocks","Set an honest, descriptive User-Agent (OAuth app convention: platform:app:version)","Detect 403 once and stop the job instead of retrying the same blocked IP","Offer OAuth-authenticated mode for restricted content"],"tags":["http","forbidden","network","blocking"],"backgroundTag":"http-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}