{"record":{"id":"dc541eac769682c5","repo":"tonhowtf/omniget","slug":"o-post-n-o-veio-na-resposta-apagado-privado-ou-id-errado","errorCode":null,"errorMessage":"o post não veio na resposta (apagado, privado ou id errado)","messagePattern":"o post não veio na resposta \\(apagado, privado ou id errado\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":477,"sourceCode":"            if tail.is_empty() {\n                String::new()\n            } else {\n                format!(\": {}\", tail)\n            }\n        ));\n    }\n    Ok((files, tail))\n}\n\n// ───────────────────────── execução ─────────────────────────\n\nasync fn fetch_post(fetcher: &Fetcher, id: &str) -> Result<Value> {\n    let v = fetcher\n        .get_json(&super::post_json_url(id, \"top\", 1))\n        .await?;\n    v.pointer(\"/0/data/children/0/data\")\n        .cloned()\n        .ok_or_else(|| anyhow!(\"o post não veio na resposta (apagado, privado ou id errado)\"))\n}\n\nasync fn download_direct(\n    fetcher: &Fetcher,\n    urls: &[String],\n    dest: &Path,\n    base: &str,\n    progress: &ProgressFn,\n) -> Result<Vec<String>> {\n    let mut files = Vec::new();\n    let single = urls.len() == 1;\n    for (idx, url) in urls.iter().enumerate() {\n        let ext = url\n            .split(['?', '#'])\n            .next()\n            .unwrap_or(url)\n            .rsplit('.')\n            .next()","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L459-L495","documentation":"fetch_post requests the Reddit post JSON listing and navigates the pointer /0/data/children/0/data; if that path is absent the post is not retrievable, and the error explains the usual causes: deleted post, private post, or wrong id. It's a guard against Reddit returning an empty children array or an unexpected envelope instead of failing with a cryptic None later.","triggerScenarios":"Calling the reddit download run flow with a post id that doesn't exist, was deleted/removed by moderators, is in a private/quarantined subreddit, or a malformed id that yields an empty listing.","commonSituations":"Typos in the post id, post removed since link was saved, subreddit gone private, Reddit rate-limiting/edge returning an empty listing for valid ids.","solutions":["Verify the post id/URL in a browser — confirm the post still exists and is public","Check the id format (Reddit base-36 id, no URL-encoding issues)","Retry later if Reddit returned an empty listing transiently (rate limit/edge error)","Handle authentication if the post requires login to view"],"exampleFix":"// before: blind fetch\nlet post = fetch_post(&fetcher, id).await?;\n// after: validate id shape first\nif id.len() < 4 || !id.chars().all(|c| c.is_ascii_alphanumeric()) {\n    return Err(anyhow!(\"id de post inválido: {}\", id));\n}\nlet post = fetch_post(&fetcher, id).await?;","handlingStrategy":"validation","validationCode":"fn looks_like_reddit_id(id: &str) -> bool {\n    (4..=12).contains(&id.len())\n        && id.chars().all(|c| c.is_ascii_alphanumeric())\n}","typeGuard":null,"tryCatchPattern":"match run(&args).await {\n    Err(e) if e.to_string().contains(\"o post não veio\") => {\n    eprintln!(\"post apagado/privado ou id errado: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Validate the post id/URL format before calling","Verify the post opens publicly in a browser before automating downloads","Treat empty Reddit listings as possibly transient and retry once"],"tags":["reddit","api","not-found","rust"],"backgroundTag":"entity-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"}