tonhowtf/omniget · error

nao reconheci um post do X em

Error message

nao reconheci um post do X em: {}

What it means

unroll reconstructs an X thread and throws this error when `post_id_from` cannot extract a tweet ID from the input. The parser accepts a bare numeric ID or any URL containing `status(es)/<digits>` or `i/web/status/<digits>` (x.com or twitter.com). The unrecognized input is embedded in the message.

Solutions

  1. Pass either the bare tweet ID (all digits) or the full x.com/twitter.com status URL — strip surrounding text/whitespace before calling
  2. Pre-validate with the same pattern the library uses (`(?:status(?:es)?|i/web/status)/(\d+)`) and surface a friendly message on no-match
  3. If handling alternate frontends (fixupx, vxtwitter), rewrite the host to x.com or extract the status path yourself before calling unroll

Example fix

// before
unroll(shared_text).await?;
// after
let re = regex::Regex::new(r"(?:status(?:es)?|i/web/status)/(\d+)").unwrap();
let id: Option<String> = if shared_text.trim().chars().all(|c| c.is_ascii_digit()) && !shared_text.trim().is_empty() {
    Some(shared_text.trim().to_string())
} else {
    re.captures(shared_text).map(|c| c[1].to_string())
};
let id = id.ok_or_else(|| anyhow!("'{shared_text}' nao contem um ID de post do X"))?;
unroll(&id).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn extract_tweet_id(input: &str) -> Option<String> {
    let s = input.trim();
    if !s.is_empty() && s.chars().all(|c| c.is_ascii_digit()) {
        return Some(s.to_string());
    }
    let re = regex::Regex::new(r#"(?:status(?:es)?|i/web/status)/(\d+)"#).ok()?;
    re.captures(s).map(|c| c[1].to_string())
}
// only call unroll when extract_tweet_id(input).is_some()

Type guard

fn is_tweet_ref(input: &str) -> bool {
    let s = input.trim();
    (!s.is_empty() && s.chars().all(|c| c.is_ascii_digit()))
        || regex::Regex::new(r#"(?:status(?:es)?|i/web/status)/\d+"#).map(|r| r.is_match(s)).unwrap_or(false)
}

Try / catch

match unroll(input).await {
    Err(e) if e.to_string().contains("nao reconheci um post") => {
        eprintln!("Cole o link do post (x.com/.../status/ID) ou o ID numerico");
    }
    Err(e) => return Err(e),
    Ok(thread) => thread,
}

Prevention

When it happens

Trigger: Calling unroll with a non-numeric, non-status-URL string: a profile URL (https://x.com/nasa), a shortened t.co/syndication link without a status path, an ID containing letters or separators (spaces, commas from copy-paste), or an empty string.

Common situations: Pasting a profile or media-tab URL instead of a tweet link; passing a vxtwitter/fxtwitter-style URL variant whose path the regex does not cover; extracting the ID with wrong split (grabbing `photo/1` or trailing `?s=20` text); mobile share sheets adding extra text around the link.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/thread.rs:36

    pub source: String,
}

impl Thread {
    pub fn title(&self) -> String {
        let first = self.posts.first().unwrap_or(&self.focal);
        let line = first.text.lines().next().unwrap_or("").trim();
        let short: String = line.chars().take(80).collect();
        if short.is_empty() {
            format!("Thread de @{}", first.author.handle)
        } else {
            short
        }
    }
}

pub async fn unroll(input: &str) -> anyhow::Result<Thread> {
    let id = super::post_id_from(input)
        .ok_or_else(|| anyhow!("nao reconheci um post do X em: {}", input))?;
    match super::fx::thread(&id).await {
        Ok((focal, posts, truncated)) => {
            let posts = if posts.is_empty() {
                vec![focal.clone()]
            } else {
                posts
            };
            Ok(Thread {
                focal,
                posts,
                truncated,
                source: "fxtwitter".into(),
            })
        }
        Err(fx_err) => {
            tracing::info!("[x] fxtwitter falhou ({}), tentando GraphQL", fx_err);
            unroll_graphql(&id)
                .await

View on GitHub (pinned to 8600b91f42)