tonhowtf/omniget · warning

post ou perfil privado

Error message

post ou perfil privado

What it means

FxTwitter's API responded with code 401 (or the HTTP status was 401): the requested X/Twitter post or profile is private, so the mirror cannot fetch it without authentication. Raised in get(), which backs every X-related entry point (status, thread, conversation, profile lookups).

Solutions

  1. Inform the user the content is private and cannot be fetched via FxTwitter.
  2. Use an authenticated X session (the native XClient path) if credentials for an authorized follower exist.
  3. Verify whether the account is protected before making repeated attempts.
  4. Do not retry — 401 is deterministic for the public API.

Example fix

null
Defensive patterns

Strategy: try-catch

Try / catch

match fx::profile(&handle).await {
    Ok(u) => u,
    Err(e) if e.to_string().contains("post ou perfil privado") => {
        eprintln!("{handle} e protegido; necessario credenciais autorizadas");
        return Ok(None);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Requesting a protected (private-locked) account's profile or profile_statuses, or a tweet from a protected account / a limited-audience reply via get()-backed endpoints.

Common situations: Trying to read posts from a private X account; fetching a reply visible only to followers; a formerly public account was set to protected; age-restricted content.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/fx.rs:55

        .collect();
    if !q.is_empty() {
        req = req.query(&q);
    }
    let resp = req.send().await?;
    let status = resp.status();
    let body: Value = resp
        .json()
        .await
        .map_err(|e| anyhow!("FxTwitter: resposta invalida ({})", e))?;
    let code = body
        .get("code")
        .and_then(|c| c.as_u64())
        .unwrap_or(status.as_u16() as u64);
    if code == 404 {
        return Err(anyhow!("nao encontrado no X (ou o post e privado)"));
    }
    if code == 401 {
        return Err(anyhow!("post ou perfil privado"));
    }
    if code == 429 {
        return Err(anyhow!(
            "FxTwitter: limite de requisicoes atingido, tente de novo em instantes"
        ));
    }
    if code >= 400 {
        let msg = body
            .get("message")
            .and_then(|m| m.as_str())
            .unwrap_or("erro");
        return Err(anyhow!("FxTwitter: {} ({})", msg, code));
    }
    Ok(body)
}

fn s(v: &Value, k: &str) -> String {
    v.get(k).and_then(|x| x.as_str()).unwrap_or("").to_string()

View on GitHub (pinned to 8600b91f42)