Skip to content

fix(pinterest): retry Pinterest's anti-spam pin block instead of failing with "Unknown Error" - #1962

Merged
egelhaus merged 1 commit into
stagingfrom
fix/pinterest-spam-block-retry
Aug 29, 2026
Merged

egelhaus merged 1 commit into
stagingfrom
fix/pinterest-spam-block-retry

Conversation

@giladresisi

@giladresisi giladresisi commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Bug fix (backend, Pinterest provider error mapping). Adds a block (Pins) we have in place to combat spam branch to PinterestProvider.handleErrors, above the "Board not found" branch, returning type: 'retry' with a message telling the user to space their pins out and try again later. Previously Pinterest's anti-spam block fell through handleErrors and reached the user as "Unknown Error". Nothing is created when Pinterest blocks a pin, so the retry cannot duplicate; the attempt count is the existing three-attempt budget in SocialAbstract.fetch. Open question for review: three retries five seconds apart will not clear a spam block, so bad-body with this same message may be the better classification.

Why was this change needed?

A user reported pins failing with "An error occurred while posting on pinterest: Unknown Error" and no way to tell what went wrong.

The stored failure held Pinterest's real response:

{"code":9,"message":"Sorry! You've hit a block (Pins) we have in place to combat spam. Please try again later!"}

handleErrors in the Pinterest provider had no branch for that block, so runInConcurrent fell back to its generic 'Unknown Error' value and threw BadBody, which is non-retryable. Two things went wrong as a result: the user saw a message that carried none of the information Pinterest gave us, and the pin was failed permanently even though Pinterest explicitly asked us to retry later.

Looking at the affected account over a week, every one of the 79 failures on that channel was this same block, and they were concentrated in a single day where a few hundred pins were pushed at once (75 failures out of 264 pins that day, 4 out of 100 the next day, 0 out of 49 the day after). Pins sent at a normal pace kept publishing to the same boards, so the block is a rate/anti-spam condition and is transient.

This maps the block to a curated, retryable message, matching the existing 'Unable to reach the URL' branch in the same function: the pin gets retried instead of dying, and the user is told to space their pins out.

Other information:

Scope is deliberately one error string. Two other open PRs touch the same handleErrors function and are independent of this one: #1907 (retry transient "Something went wrong on our end") and #1931 (map "could not fetch the image" as retryable).

Not verified end to end, since reproducing it means getting an account genuinely rate-limited by Pinterest. The mapping is driven by the exact response body captured from the failed publish.

QA

  1. Connect a Pinterest channel and select a board
  2. Stub the create-pin response with a body containing "block (Pins) we have in place to combat spam"
  3. Publish a pin - logs show three bounded attempts, then the post errors with the new "Pinterest temporarily blocked this pin as suspected spam" message, not "Unknown Error"
  4. Open the board and confirm no pin was created
  5. Remove the stub and publish a pin normally to confirm the happy path is unaffected
  6. Confirm a "Board not found" error still fails immediately without retrying

Checklist:

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA) (ICLA for individuals, CCLA for entities).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue

Pinterest answers pin creation with code 9 and "Sorry! You've hit a block
(Pins) we have in place to combat spam. Please try again later!" when an
account pins too fast. handleErrors had no branch for it, so
runInConcurrent fell back to the generic "Unknown Error" and threw
BadBody, marking the failure non-retryable.

The customer-visible result was a post stuck in ERROR with no usable
message, even though Pinterest had told us exactly what happened and
asked us to retry. One account hit this 79 times over a week, all of them
after bursting a few hundred pins in a single day, while pins sent at a
normal pace kept publishing to the same boards.

Map the block to a retryable curated message, matching the existing
"Unable to reach the URL" branch, so the pin is retried later and the
user is told to space their pins out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BKkCBWJGjc6iJ1MDLpDx21
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Aug 25, 2026
@strix-security

strix-security Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Strix Security Review

No security issues found.

Updated for effb6b7.


Reviewed by Strix
Re-run review · Configure security review settings

@postiz-agent

postiz-agent Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@egelhaus
egelhaus added this pull request to the merge queue Aug 29, 2026
Merged via the queue into staging with commit 486833d Aug 29, 2026
10 checks passed
@egelhaus
egelhaus deleted the fix/pinterest-spam-block-retry branch August 29, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants