Repository navigation
fix(extract): stop reporting a per-domain rejection limit as a used-up allowance - #84
Merged
jonathan-zenrows merged 1 commit intoNov 23, 2026
Conversation
…p allowance A 429 domain_rejection_limit from the prepare endpoint means this domain's preparations failed verification as often as the monthly per-domain limit allows. The CLI mapped every 429 to EXTRACT_PREPARE_OUT_OF_ALLOWANCE, which told callers their allowance was gone when nothing was spent and other domains could still be prepared. It is now EXTRACT_PREPARE_DOMAIN_REJECTION_LIMIT with the server's detail and the next step. A 429 with a code the CLI does not know reports the server's detail instead of claiming the allowance. The docs also say a preparation rejected by verification gives its slot back.
jonathan-zenrows
marked this pull request as ready for review
November 23, 2026 08:38
gonzalo-zenrows
approved these changes
Nov 23, 2026
gonzalo-zenrows
left a comment
Contributor
There was a problem hiding this comment.
I verified that domain_rejection_limit tells the caller to stop retrying only the affected domain, including when the server returns a limit of 0. An explicit out_of_allowance keeps its existing error, and the CLI sends the prepare request once.
jonathan-zenrows
deleted the
fix/extract-prepare-rejection-limit-not-allowance
branch
November 23, 2026 21:22
Merged
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 changes for a caller
zenrows extract preparenow reports the prepare endpoint's 429domain_rejection_limitas its own error,EXTRACT_PREPARE_DOMAIN_REJECTION_LIMIT. It means verification rejected this domain's preparations as many times as the monthly per-domain limit allows. The error carries the server'sdetailaslikely_cause. Itsnext_actionnames four facts:--css.A 429 with a code the CLI does not know is no longer reported as a used-up allowance. It is
EXTRACT_PREPARE_FAILEDwith the server's detail in the message and "do not retry in a loop" as the next step.out_of_allowancekeeps its error,EXTRACT_PREPARE_OUT_OF_ALLOWANCE, word for word.The project readme and both extract skills now list the new code and say that a preparation rejected by verification gives its slot back.
Why
Before this change every 429 from the prepare endpoint became
EXTRACT_PREPARE_OUT_OF_ALLOWANCE. A caller who hit the per-domain rejection limit read that the allowance was gone. That was false. The submission spent nothing, and the account could still prepare other domains.Tests
npm run typecheck: clean.npm test: 517 of 517 pass.tests/extract-prepare.test.ts:domain_rejection_limitwith limit 3.domain_rejection_limitwith limit 0.out_of_allowancemaps toEXTRACT_PREPARE_OUT_OF_ALLOWANCEwith "10 of 10 used".Live proof
The built CLI (
node dist/bin/zenrows.js) was run against a local HTTP stub onZENROWS_API_BASE=http://127.0.0.1:18765/v1. The stub answersPOST /v1/extract/prepared-domainswith a 429 problem body. The key was a dummy value.Stub answers 429
domain_rejection_limit(the server's exact body,rejected: 3,limit: 3):With
--json:{ "ok": false, "error": { "code": "EXTRACT_PREPARE_DOMAIN_REJECTION_LIMIT", "message": "example.com has reached the monthly limit of preparations rejected by verification (3 rejected this month, limit 3 per domain).", "likely_cause": "(domain_rejection_limit) example.com had 3 rejected preparation attempts this month (failed verification); the limit is 3 per domain per month. This submission was not accepted and not counted against your allowance. New attempts for this domain reopen at the start of next month (UTC).", "next_action": "Do not retry this domain this month; new attempts reopen at the start of next month (UTC). This submission used no allowance slot, and other domains can still be prepared. Meanwhile extract this domain with --css and explicit selectors.", "suggested_commands": [ "zenrows extract <url> --css '{\"title\":\"h1\"}'" ], "server_code": "domain_rejection_limit" } } exit=1Negative case: the same stub answers 429
out_of_allowance(used: 10,limit: 10), and the CLI prints the same allowance error as before:The stub logged exactly one
POST /v1/extract/prepared-domainsper run, so the CLI does not retry either 429.