tonhowtf/omniget · error

X : HTTP (sessao expirada? entre de novo no X)

Error message

X {}: HTTP {} (sessao expirada? entre de novo no X)

What it means

After retries, gql_get got an HTTP 401/403 (kind "auth:<status>") while the client considered itself logged in (cookies present), so it reports that the X session is expired and asks the user to log in again. The message interpolates the trimmed status code (401 or 403).

Solutions

  1. Re-authenticate with X: delete the stored cookie jar and log in again so fresh auth_token/ct0 are captured
  2. Clear ct0 and let the client refresh it; ensure the x-csrf-token header matches the current ct0 cookie
  3. Check that cookies were not truncated/corrupted in storage (re-import from the browser)
  4. If this happens for one op only, confirm that op is allowed for your account (some endpoints 403 without Premium/permissions)
  5. Handle the error in callers by surfacing a 're-login' prompt rather than retrying endlessly

Example fix

// before
match client.gql_get("UserTweets", v, f, None).await {
    Err(e) if e.to_string().contains("sessao expirada") => prompt_relogin()?;
    r => r?,
}
// after
if !client.authed() || cookies_expired()? {
    prompt_relogin()?; // refresh auth_token + ct0 before any gql call
}
let v = client.gql_get("UserTweets", v, f, None).await?;
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust: verify a session exists before GraphQL calls
if !client.authed() {
    return Err(anyhow!("not logged in to X; re-login required"));
}

Try / catch

match client.gql_get(op, vars, feats, None).await {
    Err(e) if e.to_string().contains("sessao expirada") => {
        relogin()?; // fresh auth_token + ct0
        client.gql_get(op, vars, feats, None).await
    }
    r => r,
}

Prevention

When it happens

Trigger: Stored X cookies (auth_token/ct0) are stale, revoked, or the ct0 csrf header no longer matches the session; server responds 401/403 to a gql_get op and the guest-token fallback is not used because authed() is true.

Common situations: User changed password or logged out elsewhere, cookies copied from a browser session that later expired, clock drift invalidating csrf, or X rotating ct0 so the cached header mismatches.

Related errors


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

Appendix: source

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

            }
            let headers = self.headers("GET", &path).await?;
            let resp = self
                .http
                .get(&url)
                .headers(headers)
                .query(&query)
                .send()
                .await?;
            match Self::check(resp, op).await? {
                Ok(v) => return Ok(v),
                Err(kind) if tries < 3 => {
                    if kind == "not_found" {
                        tracing::info!("[x] {} 404: recarregando query ids", op);
                        self.refresh_ids().await?;
                    } else if !self.authed() {
                        self.guest_token(true).await?;
                    } else {
                        return Err(anyhow!(
                            "X {}: HTTP {} (sessao expirada? entre de novo no X)",
                            op,
                            kind.trim_start_matches("auth:")
                        ));
                    }
                }
                Err(kind) => return Err(anyhow!("X {}: {}", op, kind)),
            }
        }
    }

    pub async fn gql_post(
        &self,
        op: &str,
        variables: Value,
        features: Option<Value>,
    ) -> anyhow::Result<Value> {
        self.require_login()?;

View on GitHub (pinned to 8600b91f42)