tonhowtf/omniget · error

perfil nao encontrado

Error message

perfil nao encontrado

What it means

api.rs profile() requests a User via Pinterest's UserResource with field_set_key "profile" and parses the result. When `parse_user(&data)` returns None — the response contains no usable profile object — the library raises "perfil nao encontrado". Typically the account was deleted, suspended, or Pinterest returned a non-profile response (login wall, 404 page).

Solutions

  1. Confirm the username still exists at pinterest.com/<username>/ in a browser.
  2. Attach valid session cookies so Pinterest returns profile JSON to your client.
  3. Slow down / add retries — anonymous scraping often triggers challenge pages.
  4. Handle as user-not-found upstream and prune dead usernames from your dataset.

Example fix

// before
let user = api.profile(&name).await?;
// after
let user = api.profile(&name).await
    .with_context(|| format!("profile lookup failed for {name}"))?;
// skip on not-found:
let user = match api.profile(&name).await { Ok(u) => u, Err(_) => { prune(&name); continue; } };
Defensive patterns

Strategy: try-catch

Validate before calling

// Pinterest usernames: 3-30 chars, alphanumerics and underscores
fn is_valid_username(u: &str) -> bool { (3..=30).contains(&u.len()) && u.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') }

Type guard

fn profile_found(u: &Option<User>) -> bool { u.is_some() }

Try / catch

match api.profile(&name).await {
    Ok(u) => sync(u),
    Err(e) if e.to_string().contains("perfil nao encontrado") => deactivate(&name),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling PinterestApi::profile(username) for a deactivated/suspended/nonexistent username, or when unauthenticated requests get a challenge page instead of profile JSON.

Common situations: Following stale usernames in a sync pipeline; accounts renamed or deactivated since last crawl; Pinterest rate-limiting anonymous traffic and serving fallback pages.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/pinterest/api.rs:994

                }
            }
            match next {
                Some(b) if !out.is_empty() => bookmark = Some(b),
                _ => break,
            }
        }
        Ok(out)
    }

    pub async fn user(&self, username: &str) -> anyhow::Result<User> {
        let (data, _) = self
            .resource(
                "User",
                json!({ "username": username, "field_set_key": "profile" }),
                &format!("/{}/", username),
            )
            .await?;
        parse_user(&data).ok_or_else(|| anyhow!("perfil nao encontrado"))
    }

    pub async fn user_boards(&self, username: &str) -> anyhow::Result<Vec<Board>> {
        let mut out = Vec::new();
        let mut bookmark: Option<String> = None;
        loop {
            let mut opts = json!({
                "username": username, "page_size": 100, "privacy_filter": "all", "sort": "last_pinned_to",
                "field_set_key": "profile_grid_item", "filter_stories": false, "group_by": "visibility", "include_archived": true
            });
            if let Some(b) = &bookmark {
                opts["bookmarks"] = json!([b]);
            }
            let (data, next) = self
                .resource("Boards", opts, &format!("/{}/_saved/", username))
                .await?;
            let before = out.len();
            for v in data.as_array().cloned().unwrap_or_default() {

View on GitHub (pinned to 8600b91f42)