{"record":{"id":"f44956cb348e55a6","repo":"tonhowtf/omniget","slug":"post-not-found","errorCode":null,"errorMessage":"Post not found","messagePattern":"Post not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/reddit.rs","lineNumber":137,"sourceCode":"\n    async fn fetch_post_data(&self, post_id: &str) -> anyhow::Result<serde_json::Value> {\n        let url = format!(\"https://www.reddit.com/comments/{}.json\", post_id);\n\n        let response = self\n            .client\n            .get(&url)\n            .header(\"Accept\", \"application/json\")\n            .send()\n            .await?;\n\n        if !response.status().is_success() {\n            return Err(anyhow!(\"Reddit retornou HTTP {}\", response.status()));\n        }\n\n        let json: serde_json::Value = response.json().await?;\n\n        if !json.is_array() {\n            return Err(anyhow!(\"Post not found\"));\n        }\n\n        json.as_array()\n            .and_then(|arr| arr.first())\n            .and_then(|listing| listing.pointer(\"/data/children/0/data\"))\n            .cloned()\n            .ok_or_else(|| anyhow!(\"Post not found\"))\n    }\n\n    fn construct_audio_url(fallback_url: &str) -> Vec<String> {\n        let video = fallback_url.split('?').next().unwrap_or(fallback_url);\n        let mut candidates = Vec::new();\n\n        if video.contains(\".mp4\") {\n            if let Some(base) = video.split('_').next() {\n                candidates.push(format!(\"{}_audio.mp4\", base));\n                candidates.push(format!(\"{}_AUDIO_128.mp4\", base));\n            }","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/reddit.rs#L119-L155","documentation":"After a successful HTTP status, fetch_post_data expects Reddit's JSON listing response to be an array. If the body is valid JSON but not an array (e.g. an error object like {\"message\": \"Not Found\"} or an HTML page mis-reported), it throws \"Post not found\" because no post listing can be extracted.","triggerScenarios":"Reddit returns HTTP 200 but the parsed serde_json::Value is not an array — typically an error object body for a deleted/removed post or blocked request.","commonSituations":"Posts deleted by moderators or users, shadow-removed posts that still return 200, or Reddit returning a JSON error payload instead of the listing array.","solutions":["Check the post URL in a browser; if the post was deleted/removed, it cannot be fetched.","Log the raw response body when this occurs to see Reddit's actual error message.","Add a distinguishing message based on the JSON content (e.g. detect {\"error\": 404}) to tell users the post was removed.","Retry the request in case Reddit served a transient malformed body."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match native_get_media_info(url).await {\n    Err(e) if e.to_string() == \"Post not found\" => mark_post_unavailable(url),\n    Err(e) => propagate(e),\n    Ok(info) => use(info),\n}","preventionTips":["Filter out deleted/removed posts before fetching (check for [removed] indicators upstream).","Log raw response bodies when parsing fails to distinguish error payloads from listings.","Keep the Reddit JSON API client version aware of Reddit response changes."],"tags":["reddit","json","unexpected-response-shape"],"backgroundTag":"unexpected-response-shape","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"}