tonhowtf/omniget · error

o post não veio na resposta (removido, privado ou apagado?)

Error message

o post não veio na resposta (removido, privado ou apagado?)

What it means

`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.

Solutions

  1. Check the post in a browser first to confirm it still exists and is publicly visible
  2. Authenticate (session/OAuth) if the subreddit or post requires it
  3. Treat this as a user-facing 'post unavailable' condition rather than a parser bug — surface the message directly
  4. If the post should exist, check for Reddit's t3 stub markers (e.g. [deleted]/[removed] authors) and handle them explicitly

Example fix

// before
let post_data = arr.first().and_then(|l| l.pointer("/data/children/0/data")).ok_or_else(|| anyhow!("o post não veio na resposta"))?;
// after
let post_data = match arr.first().and_then(|l| l.pointer("/data/children/0/data")) {
    Some(d) => d,
    None => anyhow::bail!("post indisponível: verifique se ele foi removido, apagado ou é privado"),
};
Defensive patterns

Strategy: validation

Validate before calling

fn has_post(root: &Value) -> bool {
    root.as_array()
        .and_then(|a| a.first())
        .and_then(|l| l.pointer("/data/children/0/data"))
        .is_some()
}

Type guard

fn post_is_available(root: &Value) -> bool {
    root.pointer("/0/data/children/0/data").is_some()
}

Try / catch

match parse_thread_json(&root) {
    Ok(parsed) => parsed,
    Err(e) if e.to_string().contains("o post não veio") => {
        eprintln!("post removido, privado ou apagado — pulando");
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

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

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

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/thread.rs:197

                        parent_id,
                        children,
                    });
                }
            }
            _ => {}
        }
    }
}

/// A resposta de um permalink é `[listing do post, listing dos comentários]`.
pub fn parse_thread_json(root: &Value) -> Result<(Post, Vec<Comment>, Vec<MoreRef>)> {
    let arr = root
        .as_array()
        .ok_or_else(|| anyhow!("resposta inesperada do Reddit (não é a lista de dois listings)"))?;
    let post_data = arr
        .first()
        .and_then(|l| l.pointer("/data/children/0/data"))
        .ok_or_else(|| anyhow!("o post não veio na resposta (removido, privado ou apagado?)"))?;
    let post = parse_post(post_data);
    let mut flat = Vec::new();
    let mut mores = Vec::new();
    if let Some(children) = arr.get(1).and_then(|l| l.pointer("/data/children")) {
        parse_things(children, &mut flat, &mut mores);
    }
    Ok((post, flat, mores))
}

/// O `things` de `api/morechildren.json`.
pub fn parse_more_json(root: &Value) -> (Vec<Comment>, Vec<MoreRef>) {
    let mut flat = Vec::new();
    let mut mores = Vec::new();
    if let Some(things) = root
        .pointer("/json/data/things")
        .or_else(|| root.pointer("/data/things"))
    {
        parse_things(things, &mut flat, &mut mores);

View on GitHub (pinned to 8600b91f42)