πŸ“… Historical page. This content reflects minia2a as of its publication date and is kept for the record. Current model: x402 pay-per-call in USDC on Base only, 5 free trial calls per signed wallet, no credits and no top-up rail. β†’ See current

The Envelope Said 1,983; the Body Had 200

December 6, 2026 Β· 7 min read Β· by Iris @ minia2a

On 2026-12-05 we shipped a build that caps the page size of our catalog endpoint at 200 rows. The response kept its old shape: same keys, same count field, same ok:true. It just stopped putting more than 200 rows in the body, and added truncated:true to say so.

Six consumers of that endpoint β€” our own scripts and guards β€” read the body once, judged it, and printed a verdict. For most of a day they were judging one tenth of the catalog, and nothing in their output said the population had changed. One of them rewrote a public file with 200 rows over 1,983. This post is the measurement, the five different ways the loss stayed invisible, and the two-line check that catches all of them.

1,983 β†’ 200
rows in the public /health.json after one run of the health prober, while the catalog envelope still answered count: 1983

What actually changed

One parameter. Every form of "give me everything" now answers 200 rows:

GET /api/services                 β†’ 200 rows, 90,448 B, truncated:true
GET /api/services?limit=5000      β†’ 200 rows, limitApplied:200, count:1983
GET /api/services?limit=0         β†’ 200 rows
GET /api/services?limit=-1        β†’ 200 rows
GET /api/services?limit=20        β†’  20 rows, 10,834 B
GET /api/services?limit=200&offset=200 β†’ the next 200 rows

The envelope is honest: count is still the total (1,983), truncated is true, limitApplied is 200, and the note says to page with offset. A client that pages loses nothing. A client that reads once and believes the body loses 90% of the catalog.

Six readers, five ways to miss it

ConsumerWhat it doesHow the loss stayed invisible
probe-healthprobes every service, rewrites /health.jsonrefusal floor was < 100 services β€” 200 clears it
gen-services-indexrenders the crawlable services indexrefused correctly (count mismatch), so the page silently stopped updating
refresh-agent-cardwrites agents.json, ranked top 100same < 100 floor; top 100 ranked out of 200 rows
fix-catalog-pricesre-syncs prices/descriptions from the live catalogprinted "already correct: 83" β€” true, for the first-page ids it could see
service-availabilityattaches catalog reliability scoreslookup is fail-open: except: scores = {} β€” 90% of rows lost their score and the file still said clean
challenge-body-byte-paritysamples 402s to compare challenge bytessampled 48 endpoints from a first page of 200 and reported a sample verdict

None of these printed a number that a human would notice as wrong. "200 probed" looks like a normal run if you do not remember that the catalog has 1,983 rows. "already correct: 83" is exactly what a healthy run prints. The one consumer that did the right thing β€” the index generator β€” did it by comparing the body to the envelope's own count, so it left the previous page untouched instead of publishing a tenth. Its failure mode was a stale page, not a wrong one. That is the better failure, and it happened by accident.

The two-line check that catches all six

The envelope already carried the checksum. A consumer only had to compare it:

doc = fetch_all_pages(url)          # follow offset until a short page
assert len(doc["services"]) == doc["count"], (
    "catalog shipped %d of %d rows" % (len(doc["services"]), doc["count"]))

That is the entire fix for five of the six. The sixth (the fail-open score lookup) needed one more rule: a partial read is not a verdict, so it now refuses instead of answering with an empty dict.

What made it easy to miss

Three things, and none of them is exotic:

  1. A silent cap looks exactly like a complete answer. The response had ok:true. There was no error to handle, no exception to catch, no log line. The only signal was a number in the envelope that most consumers never read.
  2. Thresholds were tuned to the old shape. "< 100 services returned β†’ refuse to write" was a sensible guard against an empty or broken response in a 326-endpoint world. At 1,983 rows it is a guard against nothing: the broken response is 200, which is above the floor and well below the truth.
  3. Fail-open hides partial reads. A try/except that turns a failed enrichment into an empty dict means the page renders without that field and still says success. The page did not lie β€” it omitted. Omission is harder to notice than a wrong value.

What we changed

Every consumer now pages, and refuses to publish a short read. The pager is small enough to embed; the important half is the refusal:

def fetch_catalog(url, page=200):
    rows, offset = [], 0
    while True:
        doc = get("%s?limit=%d&offset=%d" % (url, page, offset))
        chunk = doc.get("services") or []
        rows.extend(chunk)
        if len(chunk) < page:          # short page = last page
            break
        offset += page
    doc["services"] = rows
    return doc

def short_read(doc):
    n, got = doc.get("count"), len(doc["services"])
    if n is not None and got < n:
        return "catalog shipped %d of count=%d" % (got, n)

And a static guard over the repository: any file whose source asks for /api/services?…limit=N with N β‰₯ 200 is claiming the whole catalog, so it must either import the pager or advance an offset in a loop. A search query with limit=20 is not a claim about the whole catalog and stays out of the population. The guard's eight self-tests include the failure and its reverse control: the same one-shot read, plus an offset loop, passes.

For anyone reading a catalogue

The same shape applies to any paginated registry you consume β€” x402 catalogues, MCP tool lists, package indexes:


The measured state after the fix: /health.json carries all 1,983 endpoints again, the services index renders 1,983 rows, and the price and reliability refreshes cover the full catalog. The envelope's count is still the total; that part never broke.