Repository navigation
Scraper API: a Mercor 404 is not_found, exit 4, with the browser engines' sidecar - #7
Merged
Merged
Conversation
…nes' sidecar The Scraper API reports the target site's status in http_code on an HTTP 200 response. Its documentation says a site 404 "is returned with HTTP 200 from the API", and the API's own 404 means an unknown task id on the result endpoint, which this client does not call. So http_code 404 is Mercor saying the job is gone. That is the not_found state the browser engines reach from the navigation status, and their exit 4. The client already exited 4, but it did so with no sidecar and logged "0 jobs parsed". It now logs not_found and writes its empty result through finish_run, with the same stop reason and urls_not_found as Playwright. A non-200 from the API is still exit 5. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jehrr
marked this pull request as ready for review
October 15, 2026 23:42
This was referenced Oct 16, 2026
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.
Problem
The open question: should a Scraper API 404 exit 4 (genuinely not found) or 5 (content not obtained)? The answer depends on whose 404 it is.
/tasks/syncwithformat: "json"returns HTTP 200 withstatus,http_code,headersandbody. The docs say a site response of 404 "is returned with HTTP200from the API", and that site 4xx codes "are not considered unavailability". The API's own 404 is "task ID not found" on the async result endpoint, which this client does not call. Its other non-200s are 400, 401, 402, 408, 410, 422 and 503.http_code(since Scraper API: send waitFor as an object, read the target status from http_code #4), and every non-200 API response raises and exits 5.So
http_code: 404is Mercor's own 404: the job is gone. The browser engines classify that asnot_foundfromgoto()'s status. Driving the real Playwrightscrape()with the page stubbed to answer 404 with the sanitized real Mercor 404 body gives exit 4: stop reasoncompleted, and the address inurls_not_found.The client already exited 4 for this state, but it got there by a different route. It reached "0 jobs parsed", wrote a debug dump and returned 4 with no sidecar, even with
--allow-empty. It also never said the job was gone.Resulting behaviour
not_foundand exits 4 viafinish_run. With--allow-emptyit writes the same empty output and sidecar as Playwright (stop_reason,pages_completed,urls_not_found,jobs_not_found). Without--allow-emptynothing is written over earlier output.finish_runnow (still exit 4), so--allow-emptybehaves the same on that path.[Unreleased]has an entry.Evidence
check_a_target_404_is_exit_4_in_the_scraper_api_client_as_in_the_browser. It drives the real client from argv with onlyrequests.poststubbed:http_code: 404and the sanitized real 404 body gives exit 4, with a sidecar under--allow-emptyand none without it;http_code: 200does not give exit 4, so it is the status that decides;status,stop_reason,pages_completed,pages_failed,urls_not_foundandjobs_not_found.PYTHONDONTWRITEBYTECODE=1, caches cleared):not_foundbranch returns 5;fetch_htmldropshttp_code;urls_not_foundis omitted;ci_checks.py --help-check --sample-check --secret-checkpasses.Not changed (found while checking)
A target 5xx (Scraper API
status: "error", or a browsergoto()503) classifies asunknown. After the retries it currently ends as exit 4 in Playwright too, verified with the same stub. That is content not obtained and should be 5. It touches all three engines' state handling, so it is left for a separate change.🤖 Generated with Claude Code