tonhowtf/omniget · error

nao consegui desfazer o save de {} (HTTP {}): {}

Error message

nao consegui desfazer o save de {} (HTTP {}): {}

What it means

After POSTing to PinResource/delete, unsave() checks both the HTTP status and Pinterest's resource_response.status field. If the request failed or Pinterest reported status != "success", it raises this error embedding the pin id, HTTP status, and Pinterest's own error message (or "falhou" when absent). It wraps a server-side rejection of the delete/save-removal operation.

Solutions

  1. Read the embedded Pinterest error message in the error text — it states the actual cause.
  2. Refresh session cookies (and matching csrftoken) and retry.
  3. Confirm the pin is actually in the target account's saved list before calling unsave.
  4. Add delay between unsave calls in bulk operations to avoid rate limiting.

Example fix

// before
api.unsave(&pin_id).await?;
// after
if let Err(e) = api.unsave(&pin_id).await {
    let msg = e.to_string();
    if msg.contains("HTTP 429") { sleep(Duration::from_secs(30)).await; api.unsave(&pin_id).await?; }
    else { return Err(e); }
}
Defensive patterns

Strategy: retry

Validate before calling

// Confirm the pin is in the account's saved list before unsaving
let saved = api.user_boards(&me).await?; // or check saved-pin feed first

Type guard

null

Try / catch

for attempt in 0..3 {
    match api.unsave(&pin_id).await {
        Ok(()) => break,
        Err(e) if e.to_string().contains("HTTP 429") && attempt < 2 => sleep(30s).await,
        Err(e) => return Err(e),
    }
}

Prevention

When it happens

Trigger: Calling unsave(pin_id) when the pin is not saved by that account, the csrftoken is stale/mismatched with the session cookie, the session expired, or Pinterest rate-limits/blocks the resource delete call.

Common situations: Stale cookies after Pinterest rotated csrftoken; trying to unsave pins saved by another account; bulk unsave loops tripping rate limits; pin already removed so delete returns an error payload.

Related errors


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

Appendix: source

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

    pub async fn unsave(&self, pin_id: &str) -> anyhow::Result<()> {
        let csrf = self.csrf.clone().ok_or_else(|| {
            anyhow!("para desfazer saves informe os cookies da sua sessao (com csrftoken)")
        })?;
        let data = json!({ "options": { "id": pin_id }, "context": {} }).to_string();
        let req = self
            .http
            .post(format!("{}/resource/PinResource/delete/", ROOT))
            .header("X-CSRFToken", csrf)
            .header("Content-Type", "application/x-www-form-urlencoded")
            .form(&[("source_url", format!("/pin/{}/", pin_id)), ("data", data)]);
        let resp = self.apply_cookie(req).send().await?;
        let status = resp.status();
        let body: Value = resp.json().await.unwrap_or(Value::Null);
        if !status.is_success() || body["resource_response"]["status"].as_str() != Some("success") {
            let msg = body["resource_response"]["error"]["message"]
                .as_str()
                .unwrap_or("falhou");
            return Err(anyhow!(
                "nao consegui desfazer o save de {} (HTTP {}): {}",
                pin_id,
                status,
                msg
            ));
        }
        Ok(())
    }

    /// Feed a partir de um alvo já resolvido (board precisa do id).
    pub async fn feed_for(&self, target: &Target) -> anyhow::Result<(Feed, String)> {
        match target {
            Target::Board { user, slug } => {
                let b = self.board(user, slug).await?;
                Ok((
                    Feed::Board {
                        board_id: b.id.clone(),
                        include_sections: true,

View on GitHub (pinned to 8600b91f42)