{"record":{"id":"c48e715c0cf2c08b","repo":"tonhowtf/omniget","slug":"post-n-o-encontrado-apagado-privado-ou-id-errado","errorCode":null,"errorMessage":"post não encontrado (apagado, privado ou id errado)","messagePattern":"post não encontrado \\(apagado, privado ou id errado\\)","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/mod.rs","lineNumber":454,"sourceCode":"                            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            }\n        }\n        Err(anyhow!(\"não foi possível ler {}\", url))\n    }\n\n    /// Segue os redirecionamentos de um link curto e devolve a URL final.","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/mod.rs#L436-L472","documentation":"Reddit returns 404 Not Found for posts/comments that don't exist or aren't publicly visible. `get_json` translates that status into this message clarifying the usual causes: the post was deleted by its author, removed/made private by moderators, or the supplied ID is wrong. It is a definitive response, so no retry is attempted.","triggerScenarios":"Calling `get_json` with a post/comment ID that is mistyped or malformed; the target post was deleted or removed by moderators between listing and fetching; the post is in a private subreddit or is otherwise not publicly visible.","commonSituations":"Scraping a list of saved/bookmarked post IDs where some were since deleted; hand-typed or truncated Reddit IDs (base36); fetching crosspost IDs that were removed; ids taken from search results that are stale.","solutions":["Verify the post ID/URL is correct (full base36 id, correct base URL)","Open the URL in a browser to confirm whether the post still exists","Skip 404 targets in bulk jobs and continue with the rest (log and move on)","If the content was deleted, try the Wayback Machine or Pushshift-style archives"],"exampleFix":"// before\nlet v = client.get_json(&format!(\"https://www.reddit.com/comments/{id}.json\")).await?;\n// after\nmatch client.get_json(&format!(\"https://www.reddit.com/comments/{id}.json\")).await {\n    Ok(v) => Some(v),\n    Err(e) if e.to_string().contains(\"post não encontrado\") => {\n        eprintln!(\"skipping deleted/missing post {id}\");\n        None\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"// validate id shape before requesting: base36, non-empty, sane length\nfn valid_reddit_id(id: &str) -> bool {\n    !id.is_empty() && id.len() <= 10 && id.chars().all(|c| c.is_ascii_alphanumeric())\n}","typeGuard":"fn is_not_found_err(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"post não encontrado\")\n}","tryCatchPattern":"match client.get_json(&url).await {\n    Ok(v) => process(v),\n    Err(e) if is_not_found_err(&e) => {\n        log::warn!(\"post {id} gone (deleted/private/bad id) — skipping\");\n        Default::default()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate post ID format (non-empty base36) before fetching","Treat 404 as expected in bulk jobs: log and skip rather than abort","Re-verify stale IDs from cached lists before fetching","Check the URL in a browser first when a single post mysteriously 404s"],"tags":["http","not-found","resource","reddit"],"backgroundTag":"resource-not-found","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"}