Your Scraper Exited 0 and Returned 27% Fewer Rows: 5 Checks That Catch Silent Failures

Disclosure: I built the paid skill linked at the end of this post. This post was drafted with AI assistance. The dataset used here is a test file constructed with six faults planted in it on purpose; it is not data from a real website.

Get the free scraper output audit skill

In the constructed example below, a successful run returned 290 rows against a 400-row baseline. A row-count check flags the missing 110; duplicate and field checks explain what also went wrong in the remaining rows.

To show what that looks like in numbers, this post uses a constructed 400-row "last good run" and a broken "today" file with six typical faults planted in it. The broken run still finished without an error. Measured against the baseline, it had 27.5% fewer rows, 6.9% duplicates, a price column that was 33.5% text, and a rating field that was half empty. This post walks through the five measurements that caught all six faults, the thresholds the skill starts from, and how to run them yourself.

Jump to: The five checks · Thresholds · Finding the cause · FAQ

Scraper data quality example: rows fell from 400 to 290, 6.9% duplicates, 33.5% of prices stored as text, rating filled in 50% of rows.

Why "the job succeeded" tells you so little

A scraper's success signal measures the wrong thing. Exit code 0 means the process did not crash. HTTP 200 means the server answered. Neither says the page still contains what you came for. Most real breakage looks like this:

  • A selector still matches, but only on one of two page layouts.
  • Pagination loops back to page one after a redesign, so you get fewer unique rows and some twice.
  • A price that used to be a number in the page data is now formatted text.
  • A soft block returns a normal-looking page with the listing removed.

None of these throws an exception. All of them change the shape of the output, and shape is cheap to measure.

The five checks

1. Row count against the last good run

The broken file had 290 rows against a baseline of 400, a fall of 27.5%. A count on its own means little, because you rarely know the "right" number. A count next to the previous good run is the most sensitive single alarm you can have.

2. Duplicates by a real key

Twenty rows were duplicates by URL, 6.9% of the file. The important part is "by URL". If you compare whole rows, a re-scraped item with a new timestamp or a changed price looks unique and slips through. Pick the field that identifies one record and count on that.

3. Fill rate per field

For every field, what share of rows has a real value? In the broken file, rating was filled in 50% of rows (100% in the baseline) and seller.name in 74.8%. A fall in one field while the others hold steady is the classic signature of a selector that now matches one layout only.

Two details matter here. Flatten nested objects first, so seller.name is measured as its own field. And count placeholder strings as empty: 73 rows held the text "N/A" for the seller, which a naive not-null check counts as filled.

4. One type per field

The price column was a number in 66.5% of rows and text such as "$22.00" in the other 33.5%. Every row "has a price", so a fill-rate check passes. Downstream, a sum either fails or silently skips a third of the catalogue.

5. Markup residue in text

11.4% of titles contained HTML tags or entities such as  . This usually means the scraper took inner HTML instead of text for one layout. It is a warning rather than a failure, but it is the kind of thing a client notices first.

Terminal output of a dataset check showing per-field fill rates and seven findings, verdict FAIL.

What the gate reported

Planted faultMeasurementResultLevel
Pagination stops earlyrows vs baseline400 to 290 (−27.5%)fail
Early pages fetched twiceduplicates by URL20 rows (6.9%)fail
Price returned as text on one layoutmixed types33.5% not numericfail
Rating missing on half the itemsfill rate vs baseline100% to 50%fail
"N/A" written for missing sellersfill rate, placeholders74.8% filled, 73 placeholdersfail + warn
Inner HTML taken for some titlesmarkup residue11.4% of titleswarn

Six faults, seven findings, one verdict: fail. The scraper's own log for this run would have said "finished".

The skill's default thresholds

Every threshold is a judgment call, so write yours down instead of deciding per incident. These are the defaults in the skill linked below. They are starting points, not results from production use:

MeasurementFails whenNotes
Row count vs baselinefalls more than 20%Tighten for stable catalogues, loosen for search results.
Duplicates by keyabove 2% of rowsBelow that, warn.
Fill rate of key and required fieldsbelow 98%Applies to fields a consumer cannot do without.
Fill rate vs baseline, any fieldfalls more than 10 pointsCatches the one-layout selector.
Mixed types in a fieldabove 2% off-typeSays little for CSV, where everything is text.
Field present in baseline, gone nowalwaysA renamed field breaks consumers.
Optional field mostly emptywarn below 50%Often legitimate; confirm once.
Markup or stray whitespacewarn above 1%Cheap to fix at the source.

The one threshold not to leave at its default is the minimum row count. "At least one row" only catches an empty file. Set it to something you would actually be alarmed by.

Finding the cause before you touch the code

A failed check tells you where to look, not what happened. For each failure, pull three to five example rows and decide which of three things it is:

  • The source changed. The site no longer shows the value, or shows it differently. Open one of the affected pages in a browser and look.
  • The scraper broke. The value is on the page and the scraper misses it. This is the only case you fix in code.
  • The contract was wrong. The field was never reliably present and the requirement should be relaxed.

The temptation is to loosen a threshold until the run passes. Do that only when you have decided the contract was wrong, and say so to whoever receives the data.

Wiring it into a schedule

The useful version of all this runs without you. Three rules keep it honest:

  1. Run the check as the step after the scraper, and stop the delivery step when it fails.
  2. Keep the last passing output as the baseline. Only a passing run, or a warning you have accepted, replaces it.
  3. Store the report next to the data, so "what changed between Tuesday and Wednesday" has an answer.

Doing it yourself, or not

You can build these five checks with pandas in an afternoon: len(df), df.duplicated(subset=["url"]), df.notna().mean(), a type count per column and one regular expression. The parts that take longer are flattening nested JSON, treating placeholders as empty, and comparing against a baseline with sensible defaults.

I packaged my version as a skill for AI coding agents: Scraped Dataset QA Gate ($7 on Agensi). It is one Python script with no dependencies and no network calls. It reads a JSON array, JSON Lines or CSV, returns pass, warn or fail with a code for each finding, and exits with code 1 on failure so it can gate a pipeline. If you also publish scrapers on Apify, there is a bundle with a pre-publish check for the Actor itself.

Its limits are the limits of this whole approach: it measures shape, not truth. A price that is present, numeric and wrong passes every check in this post.

If you sell the resulting dataset, use the Apify pay-per-event margin example to see how a smaller result set affects your payout.

Salary data offers a real example of a missing field. In a sample of 6,215 US tech job postings, some employers put pay ranges in the description even when the structured pay field was empty.

Try the Scraper output audit skill

Check whether a successful collection job silently lost or duplicated records.

Example prompt: “Compare my last two exports and explain the missing rows.”

Get the free skill

The form emails a ZIP download link. Unzip it and open SKILL.md for the instructions, or install the skill folder in ~/.codex/skills/.

Which field or partition is your best early warning for a bad export? Share your experience in the comments or follow AI Stack Guide for the next comparison.

FAQ

What if I have no baseline yet?

Run the single-file checks first: duplicates, fill rates, mixed types, residue. Inspect that first output by hand, and if it is good, it becomes the baseline.

My data changes a lot from day to day. Will the count check fire constantly?

Loosen the count threshold for volatile sources and lean on the per-field checks instead. A fill rate falling from 100% to 50% is suspicious whatever the row count does.

Why not validate against a JSON Schema?

Do both if you can. A schema catches a wrong type in a single row. It does not tell you that a field is technically valid and empty in half the file, or that the file is a quarter smaller than yesterday.

Does this work for very large datasets?

The approach does. A script that loads the whole file into memory is limited by that machine's memory, so for very large files check a sample or compute the same counts in your warehouse.

Can a check like this tell me a price is wrong?

No. It can tell you the price is missing, text, or absent from half the rows. Whether $19.99 should have been $29.99 needs a comparison with the source, which is a different and more expensive kind of test.

Bottom line

A green job is not a good dataset. In a constructed example, a run that exited normally had 27.5% fewer rows, 6.9% duplicates and a price column that was one-third text, and five cheap measurements caught every planted fault: row count against the last good run, duplicates by key, fill rate per field, one type per field, and markup residue. Write your thresholds down, keep a baseline, and let the check decide whether the file ships.

Comments

Popular posts from this blog

Runway vs Kling vs Pika vs Google Flow (2026): What 1,000 Finished Seconds of AI Video Actually Cost

ChatGPT Plus vs Claude Pro vs Google AI Pro (2026): What Each $20 Plan Includes

Cursor vs Devin (ex-Windsurf) vs GitHub Copilot Pricing (2026): Which AI Coding Plan to Buy