tonhowtf/omniget · error
Post not found
Error message
Post not found
What it means
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.
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.
Defensive patterns
Strategy: try-catch
Try / catch
match native_get_media_info(url).await {
Err(e) if e.to_string() == "Post not found" => mark_post_unavailable(url),
Err(e) => propagate(e),
Ok(info) => use(info),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- o post não veio na resposta (removido, privado ou apagado?)
- resposta inesperada do Reddit (não é a lista de dois…
- a resposta da API do TikTok não era JSON
- a saída do gallery-dl não é um dump JSON válido
- cole o link de um post do Reddit, de um i.redd.it ou de um…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/f44956cb348e55a6.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/reddit.rs:137
async fn fetch_post_data(&self, post_id: &str) -> anyhow::Result<serde_json::Value> {
let url = format!("https://www.reddit.com/comments/{}.json", post_id);
let response = self
.client
.get(&url)
.header("Accept", "application/json")
.send()
.await?;
if !response.status().is_success() {
return Err(anyhow!("Reddit retornou HTTP {}", response.status()));
}
let json: serde_json::Value = response.json().await?;
if !json.is_array() {
return Err(anyhow!("Post not found"));
}
json.as_array()
.and_then(|arr| arr.first())
.and_then(|listing| listing.pointer("/data/children/0/data"))
.cloned()
.ok_or_else(|| anyhow!("Post not found"))
}
fn construct_audio_url(fallback_url: &str) -> Vec<String> {
let video = fallback_url.split('?').next().unwrap_or(fallback_url);
let mut candidates = Vec::new();
if video.contains(".mp4") {
if let Some(base) = video.split('_').next() {
candidates.push(format!("{}_audio.mp4", base));
candidates.push(format!("{}_AUDIO_128.mp4", base));
}View on GitHub (pinned to 8600b91f42)