tonhowtf/omniget · error

post não encontrado (apagado, privado ou id errado)

Error message

post não encontrado (apagado, privado ou id errado)

What it means

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.

Solutions

  1. Verify the post ID/URL is correct (full base36 id, correct base URL)
  2. Open the URL in a browser to confirm whether the post still exists
  3. Skip 404 targets in bulk jobs and continue with the rest (log and move on)
  4. If the content was deleted, try the Wayback Machine or Pushshift-style archives

Example fix

// before
let v = client.get_json(&format!("https://www.reddit.com/comments/{id}.json")).await?;
// after
match client.get_json(&format!("https://www.reddit.com/comments/{id}.json")).await {
    Ok(v) => Some(v),
    Err(e) if e.to_string().contains("post não encontrado") => {
        eprintln!("skipping deleted/missing post {id}");
        None
    }
    Err(e) => return Err(e),
}
Defensive patterns

Strategy: try-catch

Validate before calling

// validate id shape before requesting: base36, non-empty, sane length
fn valid_reddit_id(id: &str) -> bool {
    !id.is_empty() && id.len() <= 10 && id.chars().all(|c| c.is_ascii_alphanumeric())
}

Type guard

fn is_not_found_err(e: &anyhow::Error) -> bool {
    e.to_string().contains("post não encontrado")
}

Try / catch

match client.get_json(&url).await {
    Ok(v) => process(v),
    Err(e) if is_not_found_err(&e) => {
        log::warn!("post {id} gone (deleted/private/bad id) — skipping");
        Default::default()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/c48e715c0cf2c08b. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/mod.rs:454

                            r.status()
                        ));
                    }
                    let retry = r
                        .headers()
                        .get(reqwest::header::RETRY_AFTER)
                        .and_then(|v| v.to_str().ok())
                        .and_then(|v| v.trim().parse::<u64>().ok())
                        .map(Duration::from_secs);
                    tokio::time::sleep(retry.unwrap_or(wait)).await;
                    wait *= 2;
                }
                Ok(r) if r.status().as_u16() == 403 => {
                    return Err(anyhow!(
                        "o Reddit barrou o acesso público (403). Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão"
                    ));
                }
                Ok(r) if r.status().as_u16() == 404 => {
                    return Err(anyhow!(
                        "post não encontrado (apagado, privado ou id errado)"
                    ));
                }
                Ok(r) => {
                    return Err(anyhow!("HTTP {} em {}", r.status(), url));
                }
                Err(e) if attempt < TRIES => {
                    tokio::time::sleep(wait).await;
                    wait *= 2;
                    let _ = e;
                }
                Err(e) => return Err(e.into()),
            }
        }
        Err(anyhow!("não foi possível ler {}", url))
    }

    /// Segue os redirecionamentos de um link curto e devolve a URL final.

View on GitHub (pinned to 8600b91f42)