tonhowtf/omniget · error

a sessão do Goodreads não está válida: capture os cookies…

Error message

a sessão do Goodreads não está válida: capture os cookies de goodreads.com na extensão

What it means

trigger_and_wait fetches the Goodreads import page HTML and checks is_signed_out() before doing anything else. If the page indicates the user is not authenticated, the stored cookies captured by the browser extension are stale or absent, so the library aborts with this message asking the user to recapture cookies.

Solutions

  1. Log into goodreads.com in the browser and recapture cookies with the extension, then rerun the operation.
  2. Verify in the browser that goodreads.com/review/import shows the signed-in page (it should show your import/export history, not a login prompt).
  3. If cookies are fresh but the check still fails, confirm the extension captured cookies for the goodreads.com domain specifically, not amazon.com (Goodreads accounts can be linked).
  4. Clear old stored cookies for the domain in the extension first so stale values are not reused.

Example fix

// before (stale cookies stored)
run(&fetcher, &opts).await?; // session invalid

// after (extension recapture flow)
extension.capture_cookies("https://www.goodreads.com"); // user logged in
run(&fetcher, &opts).await?;
Defensive patterns

Strategy: validation

Validate before calling

// before running, sanity-check stored cookies still yield a signed-in page
let page = fetcher.get_text(IMPORT_URL).await?;
if is_signed_out(&page) {
    prompt_cookie_recapture(); // pause flow before triggering export
}

Try / catch

match run(&fetcher, &opts).await {
    Err(e) if e.to_string().contains("sessão do Goodreads") => {
        ui.ask_user_to_recapture_cookies("goodreads.com");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Running the Goodreads export flow when the Fetcher's goodreads.com cookies are missing, expired, or belong to a logged-out session — detected by the sign-out markers in the IMPORT_URL page HTML.

Common situations: User logged out of Goodreads in the browser after capturing cookies; Goodreads session expired (weeks of inactivity); extension captured cookies before the user ever logged in; cookies captured on the wrong domain.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/lists/goodreads.rs:249

            let rest = &html[at + marker.len()..];
            let id: String = rest.chars().take_while(|c| c.is_ascii_digit()).collect();
            if !id.is_empty() {
                return Some(id);
            }
        }
    }
    None
}

/// Dispara o export e espera o CSV aparecer. Devolve `(csv, segundos)`.
///
/// O caminho é o mesmo do navegador: pegar o token anti-CSRF da página de
/// importação, mandar o POST em `/review_porter/export/<id>` e depois ficar
/// perguntando pelo arquivo, que responde 404 enquanto não fica pronto.
async fn trigger_and_wait(f: &Fetcher, opts: &Options, p: &ProgressFn) -> Result<(String, u64)> {
    let page = f.get_text(IMPORT_URL).await?;
    if is_signed_out(&page) {
        return Err(anyhow!(
            "a sessão do Goodreads não está válida: capture os cookies de goodreads.com na extensão"
        ));
    }
    let uid = user_id(&page).ok_or_else(|| {
        anyhow!("não achei o id da sua conta na página de importação do Goodreads")
    })?;
    let csv_url = export_csv_url(&uid);

    // Se já existe um export pronto, aproveita: o Goodreads só deixa gerar um
    // a cada poucos dias, e gerar um novo apaga o anterior.
    let ready = !opts.force && export_link(&page).is_some();
    let started = Instant::now();
    if !ready {
        let token = csrf_token(&page).ok_or_else(|| {
            anyhow!(
                "não achei o token anti-CSRF do Goodreads; recapture os cookies e tente de novo"
            )
        })?;

View on GitHub (pinned to 8600b91f42)