tonhowtf/omniget · error

X nao entregou guest token: HTTP

Error message

X nao entregou guest token: HTTP {}

What it means

When bootstrapping an unauthenticated (guest) session, the X client POSTs to the guest token endpoint with the public bearer token. If X responds with a non-2xx status, the client errors with the HTTP status embedded, meaning X refused to issue an anonymous guest token.

Solutions

  1. Retry after a short wait; transient blocks often clear.
  2. Log in with a real account — authenticated sessions bypass the guest token flow entirely.
  3. Change network egress (disable VPN/proxy) if X is blocking the IP.
  4. Check for X API changes and update the guest token endpoint/bearer in client.rs.

Example fix

// before
if !resp.status().is_success() { return Err(anyhow!("X nao entregou guest token: HTTP {}", resp.status())); }
// after
if !resp.status().is_success() {
    tracing::warn!(status = %resp.status(), "guest token request failed; retrying once");
    resp = activate().await?; // single retry before failing
}
Defensive patterns

Strategy: retry

Try / catch

// guest token failures are often transient
match op().await {
    Err(e) if e.to_string().contains("X nao entregou guest token") => {
        tokio::time::sleep(Duration::from_secs(5)).await;
        op().await
    }
    other => other,
}

Prevention

When it happens

Trigger: gql_get or headers triggering guest_token when the guest-activation endpoint returns 4xx/5xx — e.g. X blocking the request, network/proxy interference, or X changing the guest token API.

Common situations: Requests from datacenter IPs/VPNs blocked by X; X rate-limiting or WAF-challenging anonymous activations; X API changes breaking the guest flow; system clock or TLS issues causing failures.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/client.rs:205

    async fn guest_token(&self, force: bool) -> anyhow::Result<String> {
        let mut g = GUEST.lock().await;
        if !force {
            if let Some((tok, at)) = g.as_ref() {
                if at.elapsed() < Duration::from_secs(2 * 3600) {
                    return Ok(tok.clone());
                }
            }
        }
        let resp = self
            .http
            .post("https://api.x.com/1.1/guest/activate.json")
            .header("Authorization", BEARER)
            .header("x-twitter-client-language", "en")
            .header("x-twitter-active-user", "yes")
            .send()
            .await?;
        if !resp.status().is_success() {
            return Err(anyhow!(
                "X nao entregou guest token: HTTP {}",
                resp.status()
            ));
        }
        let v: Value = resp.json().await?;
        let tok = v
            .get("guest_token")
            .and_then(|t| t.as_str())
            .ok_or_else(|| anyhow!("guest token ausente"))?
            .to_string();
        *g = Some((tok.clone(), Instant::now()));
        Ok(tok)
    }

    async fn tx_header(&self, method: &str, path: &str) -> Option<String> {
        if !self.authed() {
            return None;
        }

View on GitHub (pinned to 8600b91f42)