tonhowtf/omniget · error · anyhow::Error

o X serviu a versao deslogada da pagina

Error message

o X serviu a versao deslogada da pagina

What it means

indices() (via create()) checks the script URLs served with the page for 'entry-client-logged-out'; if present, X served the logged-out version of the page, which lacks the signature-index code, so the function bails. TxIdGen requires a logged-in session.

Solutions

  1. Refresh/re-supply valid logged-in session cookies before requesting the page.
  2. Verify the HTTP client actually attaches the cookie jar to this request.
  3. Detect the logged-out bundle early and re-authenticate automatically, then retry.
  4. Confirm the account session is still valid by hitting a lightweight authenticated endpoint first.
Defensive patterns

Strategy: validation

Validate before calling

// before calling create/indices, confirm the session is alive
if !session_has_valid_cookies().await? {
    reauthenticate().await?; // refresh cookies first
}

Try / catch

match TxIdGen::create(...).await {
    Err(e) if e.to_string().contains("versao deslogada") => {
        reauthenticate().await?;
        TxIdGen::create(...).await? // retry once with fresh session
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling create() when the fetched page's script list includes an x-web entry-client-logged-out bundle — i.e., cookies/session were missing, expired, or not accepted by X.

Common situations: Session cookies expired; auth cookie not forwarded on the request; account logged out server-side; testing without login credentials.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/txid.rs:292

        .ok()
        .and_then(|b| b.join(rel).ok())
        .map(|u| u.to_string())
        .unwrap_or_else(|| rel.to_string())
}

async fn indices(
    http: &reqwest::Client,
    html: &str,
    cookie: Option<&str>,
) -> anyhow::Result<Vec<usize>> {
    let scripts = script_urls(html);
    let x_web: Vec<String> = scripts
        .iter()
        .filter(|u| u.contains("/x-web/"))
        .cloned()
        .collect();
    if x_web.iter().any(|u| u.contains("entry-client-logged-out")) {
        anyhow::bail!("o X serviu a versao deslogada da pagina");
    }
    let pool = if x_web.is_empty() {
        scripts.clone()
    } else {
        x_web
    };
    let re = indices_re();
    let mut url = pool.iter().find(|u| re.is_match(u)).cloned();
    if url.is_none() {
        let sem = std::sync::Arc::new(tokio::sync::Semaphore::new(12));
        let mut tasks = Vec::new();
        for s in pool.into_iter().take(80) {
            let http = http.clone();
            let sem = sem.clone();
            tasks.push(tokio::spawn(async move {
                let _p = sem.acquire().await.ok()?;
                let text = http.get(&s).send().await.ok()?.text().await.ok()?;
                indices_re().find(&text).map(|m| join_url(&s, m.as_str()))

View on GitHub (pinned to 8600b91f42)