tonhowtf/omniget · error

board nao encontrado

Error message

board nao encontrado

What it means

api.rs board() requests a Board via Pinterest's BoardResource with field_set_key "detailed" and parses it. If `parse_board(&data)` yields None — no board payload in the response — the library raises "board nao encontrado". This means Pinterest did not return a parseable board for the given username/slug pair.

Solutions

  1. Check the board URL /user/slug/ resolves in a browser (slugs change on rename, e.g. -2 suffixes).
  2. Supply the owner's session cookies if the board is secret.
  3. Re-derive the slug from the user's board list via user_boards() instead of hardcoding it.
  4. Catch and treat as not-found, listing available boards for the user.

Example fix

// before
let board = api.board(user, slug).await?;
// after
let board = api.board(user, slug).await
    .map_err(|_| MyError::BoardNotFound(format!("{}/{}", user, slug)))?;
Defensive patterns

Strategy: try-catch

Validate before calling

// Board slugs are lowercase-hyphenated; verify shape before calling
fn is_valid_slug(slug: &str) -> bool { !slug.is_empty() && slug.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-') }

Type guard

fn board_resolved(b: &Option<Board>) -> bool { b.as_ref().map(|x| !x.id.is_empty()).unwrap_or(false) }

Try / catch

match api.board(user, slug).await {
    Ok(b) => process(b),
    Err(e) if e.to_string().contains("board nao encontrado") => list_boards(user).await?,
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling PinterestApi::board(user, slug) with a nonexistent board, a renamed slug, a secret board, or when Pinterest returns an anti-bot/login page so the JSON has no board object.

Common situations: Bookmarked board URLs whose slug changed after the owner renamed the board; typos in username/slug; scraping secret boards without the owner's session cookies.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

            .resource(
                "Pin",
                json!({ "id": id, "field_set_key": "detailed" }),
                &format!("/pin/{}/", id),
            )
            .await?;
        parse_pin(&data).ok_or_else(|| anyhow!("o Pinterest nao devolveu esse pin"))
    }

    pub async fn board(&self, user: &str, slug: &str) -> anyhow::Result<Board> {
        let src = format!("/{}/{}/", user, slug);
        let (data, _) = self
            .resource(
                "Board",
                json!({ "username": user, "slug": slug, "field_set_key": "detailed" }),
                &src,
            )
            .await?;
        parse_board(&data).ok_or_else(|| anyhow!("board nao encontrado"))
    }

    pub async fn board_sections(&self, board_id: &str) -> anyhow::Result<Vec<Section>> {
        let mut out = Vec::new();
        let mut bookmark: Option<String> = None;
        loop {
            let mut opts = json!({ "board_id": board_id, "page_size": 100 });
            if let Some(b) = &bookmark {
                opts["bookmarks"] = json!([b]);
            }
            let (data, next) = self.resource("BoardSections", opts, "/").await?;
            for v in data.as_array().cloned().unwrap_or_default() {
                if let Some(id) = s(&v["id"]) {
                    out.push(Section {
                        id,
                        slug: s(&v["slug"]).unwrap_or_default(),
                        title: s(&v["title"]).unwrap_or_default(),
                        pin_count: n(&v["pin_count"]),

View on GitHub (pinned to 8600b91f42)