AC-018 Conformance caught CS-RESP-013

A response grows too large

Broken bodies and broken connections

How to run this card's commands yourself

1. The problem

In one sentence

A response grows without a limit, until it is too big for clients, proxies and test tools to handle.

A story

A “list everything” endpoint returns all records in one answer. It was fine with a thousand records. After a year it returns 51 MB of valid JSON. Mobile clients run out of memory, a proxy cuts the answer at its buffer limit, and a client that reads only part of it sees half a JSON document, which looks like a syntax error.

Why it hurts

A response that big is a problem of its own: slow for users, heavy for mobile devices, costly for the network. Anything that reads only part of it, a proxy, a client or a test tool, sees a broken document.

  • For developers: a list endpoint without paging grows with the data. The answer is to page it, not to raise a limit.
  • For managers: a response size that grows with the business is a performance and cost risk, and a sign that the API has no paging contract.
  • For DevOps: put a ceiling on response size (at the gateway) and test paging with realistic data volumes.

Example

The spec declares a plain 200 with a JSON body for GET /large/json. The sandbox server sends valid JSON of the size set by the variable mb. With mb: 51, the body is 51 MB, one above the read limit.

How to detect it without clrsig

  • curl -sI URL and read content-length, or curl -s URL | wc -c for the real size.
  • In the server logs, sort responses by size.

How to fix it

There are two usual causes:

  1. The endpoint has no paging, or the page size is unbounded (more likely). Add paging with a maximum page size, and declare it in the spec.
  2. The data is large by design (an export). Then it should not be tested as a normal response. Use a download or a stream, and test it another way.

Never make the check read more just to make the number go away.

AC-010 The body is not valid JSON, or is empty, AC-017 The body is cut off, or the connection drops, AC-036 Pagination contract broken.

Words used on this page are explained once in the glossary.

2. How clrsig helps

Check

CS-RESP-013 Response longer than the read limit. State: caught. Severity today: failure (exit code 1). The executor reads at most 50 MB. A longer JSON body is reported as cut off, naming the limit and the size the server announced, and not as a JSON syntax error. A binary download cut at the limit is not compared anyway.

Command

The environment conform-fail-large-over-cap.yaml sets mb to 51. --paths limits the run to this one GET, so nothing is written:

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8080/conform-fail \
  --env clrsig/environments/conform-fail-large-over-cap.yaml \
  --paths /large/json --explain

Exit code: 0 clean, 1 a finding, 2 the spec or the setup is broken. Here it is 1.

What you see

Output from clrsig v0.21.0, recorded on 2026-11-30. The lines for the 75 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited.

conform-fail API  1.0.0
Base URL: http://localhost:8080/conform-fail
Limited by --paths /large/json

  FAIL  GET     /large/json  200  16ms
         ✗ GET /large/json 200: the response body is larger than the 50 MB Clear Signal reads (the server announced 51 MB), so it was cut off and not compared with the spec
         → [CS-RESP-013] The response body is longer than Clear Signal reads. Why: Clear Signal reads at most 50 MB of a response; the rest was cut off, so the body could not be compared with the schema (the JSON was incomplete). Where: response body (spec: GET /large/json → response 200 → body schema). Fix: Test an operation that returns less data (a smaller page or filter), or check this operation another way.

FAILED  76 operations  ·  0 passed  ·  1 failed  ·  75 skipped  753ms

How to read it: the message names the limit (50 MB) and the announced size (51 MB), and says the body was not compared.

Where to look

  • Desktop app: Check Conformance lists the failure with the same text.
  • Reports: with --format json, the finding has "checkId": "CS-RESP-013" and the kind body-too-large.
  • GitHub Action: it runs the same command.

How clrsig helps you fix it

It states the limit and the size, so you know the response is big and the JSON was fine. It suggests a smaller page or filter. It cannot say how big a response ought to be.

Limits

  • This is a limit of the tool: bodies over 50 MB are never compared in full.
  • A binary body over the limit is cut and, as always, not compared.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-018 · A response grows too large
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a response with no size limit eventually breaks clients and proxies; the fix is paging with a maximum page size.
Open with this story: A list-everything endpoint returns all records in one answer. It was fine with a thousand records. A year later it returns 51 MB of valid JSON. Mobile clients run out of memory, a proxy cuts the answer at its buffer limit, and a client that reads only part of it sees half a JSON document, which looks like a syntax error.
Say these facts, in this order:
1. In the example the server announced 51 MB of valid JSON.
2. A response that big is a problem of its own: slow, heavy for mobile devices, costly for the network.
3. Anything that reads only part of it, a proxy, a client or a test tool, sees a broken document.
4. clrsig reads at most 50 MB of a response; a longer JSON body is reported as cut off, naming the limit and the size the server announced, not as a syntax error.
5. Two usual causes: the endpoint has no paging or an unbounded page size (more likely), or the data is large by design, such as an export, which should be tested another way.
6. For managers: response size that grows with the business is a performance and cost risk.
7. For DevOps: set a ceiling on response size at the gateway and test paging with realistic data.
Show on screen: the command (clrsig conform specs/conform-fail.yaml -b http://localhost:8080/conform-fail --env clrsig/environments/conform-fail-large-over-cap.yaml --paths /large/json --explain), and the output block, copied exactly from the card.
Name the check: CS-RESP-013, Response longer than the read limit. Say the clrsig version: v0.21.0.
Explain these words once: paging (returning a long list in pieces); read limit (the most data the tool will read from one response); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: bodies over 50 MB are never compared in full; it cannot say how big a response ought to be.
Safety line (if a write is shown): not needed, this command sends one GET.
Finish with three recap questions:
1. What is the read limit? (50 MB.)
2. Does clrsig call a too-big body invalid JSON? (No; it says it was cut off.)
3. What is the usual fix? (Add paging with a maximum page size.)
Tease the next video: AC-019 · A redirect that never ends.
Do not: say "contract testing" alone; say clrsig "catches everything"; invent flags, IDs or numbers; read tables aloud; use any fact that is not in the card.