fix(pinterest): retry Pinterest's anti-spam pin block instead of failing with "Unknown Error" - #1962
Merged
Merged
Conversation
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
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 spambranch toPinterestProvider.handleErrors, above the "Board not found" branch, returningtype: 'retry'with a message telling the user to space their pins out and try again later. Previously Pinterest's anti-spam block fell throughhandleErrorsand 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 inSocialAbstract.fetch. Open question for review: three retries five seconds apart will not clear a spam block, sobad-bodywith 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:
handleErrorsin the Pinterest provider had no branch for that block, sorunInConcurrentfell back to its generic'Unknown Error'value and threwBadBody, 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
handleErrorsfunction 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
Checklist: