tonhowtf/omniget · error · anyhow::Error

a conta logada não tem nenhuma assinatura ativa (ou a…

Error message

a conta logada não tem nenhuma assinatura ativa (ou a sessão expirou)

What it means

After successfully calling the authenticated /api/v1/subscriptions endpoint, discover parses the payload with parse_subscriptions. If the parsed subscription list is empty it raises this error, meaning either the account genuinely has no active subscriptions or the session cookies are stale/expired so the API returned an empty/degraded payload.

Solutions

  1. Re-capture fresh substack.com cookies in the cookie manager (re-login first) and retry
  2. Verify the account actually has subscriptions by visiting substack.com while logged in
  3. If the account truly has none, provide the publications manually instead of using discover

Example fix

// before
let subs = substack::discover(&fetcher).await?;
// after
let subs = match substack::discover(&fetcher).await {
    Ok(s) => s,
    Err(e) if e.to_string().contains("assinatura") => relogin_and_retry(&mut fetcher)?,
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: try-catch

Try / catch

match substack::discover(&fetcher).await {
    Ok(subs) if !subs.is_empty() => subs,
    Ok(_) => Vec::new(), // treat as expired session
    Err(e) if e.to_string().contains("assinatura") => {
        refresh_cookies(&mut fetcher)?;
        substack::discover(&fetcher).await?
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: discover() is called with a valid-looking session, the request succeeds, but parse_subscriptions(&v) yields zero entries — logged-in account with no paid/free subscriptions, or expired cookies causing an empty subscriptions array.

Common situations: Fresh Substack account with no subscriptions; cookies captured weeks ago and since invalidated by re-login; subscription list filtered out entirely by the parser after a Substack API shape change.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/blogs/substack.rs:377

// ── Execução ───────────────────────────────────────────────────────────

const PAGE: usize = 12;

/// Descobre as assinaturas da conta logada. Sem sessão não há o que
/// descobrir: o endpoint responde 401.
pub async fn discover(fetcher: &Fetcher) -> Result<Vec<Subscription>> {
    if !fetcher.has_session() {
        return Err(anyhow!(
            "sem a sessão do Substack não dá para listar as suas assinaturas. Capture os cookies de substack.com no gerenciador, ou digite as publicações à mão"
        ));
    }
    let v = fetcher
        .get_json("https://substack.com/api/v1/subscriptions")
        .await?;
    let subs = parse_subscriptions(&v);
    if subs.is_empty() {
        return Err(anyhow!(
            "a conta logada não tem nenhuma assinatura ativa (ou a sessão expirou)"
        ));
    }
    Ok(subs)
}

pub async fn run(opts: &Options, progress: ProgressFn) -> Result<ArchiveResult> {
    let dest = opts.dest.trim();
    if dest.is_empty() {
        return Err(anyhow!("escolha a pasta de destino"));
    }
    if !opts.markdown && !opts.html && !opts.json {
        return Err(anyhow!("escolha ao menos um formato"));
    }
    let root = PathBuf::from(dest);
    std::fs::create_dir_all(&root)?;

    let domains: Vec<String> = COOKIE_DOMAINS.iter().map(|d| d.to_string()).collect();

View on GitHub (pinned to 8600b91f42)