{"record":{"id":"b5d751663ef533d8","repo":"tonhowtf/omniget","slug":"o-post-n-o-veio-na-resposta-removido-privado-ou-apagado","errorCode":null,"errorMessage":"o post não veio na resposta (removido, privado ou apagado?)","messagePattern":"o post não veio na resposta \\(removido, privado ou apagado\\?\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/thread.rs","lineNumber":197,"sourceCode":"                        parent_id,\n                        children,\n                    });\n                }\n            }\n            _ => {}\n        }\n    }\n}\n\n/// A resposta de um permalink é `[listing do post, listing dos comentários]`.\npub fn parse_thread_json(root: &Value) -> Result<(Post, Vec<Comment>, Vec<MoreRef>)> {\n    let arr = root\n        .as_array()\n        .ok_or_else(|| anyhow!(\"resposta inesperada do Reddit (não é a lista de dois listings)\"))?;\n    let post_data = arr\n        .first()\n        .and_then(|l| l.pointer(\"/data/children/0/data\"))\n        .ok_or_else(|| anyhow!(\"o post não veio na resposta (removido, privado ou apagado?)\"))?;\n    let post = parse_post(post_data);\n    let mut flat = Vec::new();\n    let mut mores = Vec::new();\n    if let Some(children) = arr.get(1).and_then(|l| l.pointer(\"/data/children\")) {\n        parse_things(children, &mut flat, &mut mores);\n    }\n    Ok((post, flat, mores))\n}\n\n/// O `things` de `api/morechildren.json`.\npub fn parse_more_json(root: &Value) -> (Vec<Comment>, Vec<MoreRef>) {\n    let mut flat = Vec::new();\n    let mut mores = Vec::new();\n    if let Some(things) = root\n        .pointer(\"/json/data/things\")\n        .or_else(|| root.pointer(\"/data/things\"))\n    {\n        parse_things(things, &mut flat, &mut mores);","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/thread.rs#L179-L215","documentation":"`parse_thread_json` found the two-listing array but the first listing has no `data.children[0].data` — the post object itself is missing. This happens when Reddit accepted the request but omitted the post, typically because the post is unavailable to the caller. The message lists the likely causes: removed, private, or deleted.","triggerScenarios":"Calling parse_thread_json when arr[0] lacks /data/children/0/data: the post was removed by moderators, deleted by the author, the sub is private/quarantined and the caller lacks access, or the JSON is a valid listing array but with an empty children list.","commonSituations":"Archiving a thread that was deleted moments after being linked; private subreddits accessed without auth; shadow-removed posts; country/legal blocks returning a stub listing.","solutions":["Check the post in a browser first to confirm it still exists and is publicly visible","Authenticate (session/OAuth) if the subreddit or post requires it","Treat this as a user-facing 'post unavailable' condition rather than a parser bug — surface the message directly","If the post should exist, check for Reddit's t3 stub markers (e.g. [deleted]/[removed] authors) and handle them explicitly"],"exampleFix":"// before\nlet post_data = arr.first().and_then(|l| l.pointer(\"/data/children/0/data\")).ok_or_else(|| anyhow!(\"o post não veio na resposta\"))?;\n// after\nlet post_data = match arr.first().and_then(|l| l.pointer(\"/data/children/0/data\")) {\n    Some(d) => d,\n    None => anyhow::bail!(\"post indisponível: verifique se ele foi removido, apagado ou é privado\"),\n};","handlingStrategy":"validation","validationCode":"fn has_post(root: &Value) -> bool {\n    root.as_array()\n        .and_then(|a| a.first())\n        .and_then(|l| l.pointer(\"/data/children/0/data\"))\n        .is_some()\n}","typeGuard":"fn post_is_available(root: &Value) -> bool {\n    root.pointer(\"/0/data/children/0/data\").is_some()\n}","tryCatchPattern":"match parse_thread_json(&root) {\n    Ok(parsed) => parsed,\n    Err(e) if e.to_string().contains(\"o post não veio\") => {\n        eprintln!(\"post removido, privado ou apagado — pulando\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check the post is publicly visible in a browser before archiving","Authenticate if the subreddit requires login","Detect [deleted]/[removed] author markers and short-circuit early","Treat this as an expected content-unavailable case in batch workflows (skip, don't crash)"],"tags":["reddit","json","content-unavailable","parsing"],"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"}