AC-017 Conformance caught CS-RUN-003

The body is cut off, or the connection drops

Broken bodies and broken connections

How to run this card's commands yourself

1. The problem

In one sentence

The server starts to answer, then the body stops early or the connection is closed, so the client never gets a complete response.

A story

A client asks for a report. The server sends the status line and the headers, promises a body of a certain length, and sends only part of it before the worker is killed by a deploy. The client waits, then fails with “unexpected end of file”. The status looked fine, so the server’s own logs show a normal 200.

Why it hurts

A broken connection is not a status code, so the usual alarms based on status do not see it. The user sees an error or a spinner, and the server believes everything went well.

  • For developers: check how the client handles a short body: does it retry, and is the retry safe? A cut-off write is worse (see AC-044).
  • For managers: this is the failure that status dashboards miss. A service can look healthy while users get broken downloads.
  • For DevOps: deploys, autoscaling, load-balancer idle timeouts and proxy buffer limits are the usual causes. Look at the connection logs of the proxy, not only the application.

Example

Three sandbox fixtures, all GET:

/timeout/truncated-body     the body ends before the announced length
/timeout/connection-reset   the connection is closed without a response
/hostile/gzip-lie           Content-Encoding: gzip on a body that is not gzip

The spec declares an ordinary 200 for each of them. The problem is not in what the answer says, but that no complete answer arrives.

How to detect it without clrsig

  • curl -sS -o /dev/null URL prints curl: (18) transfer closed with ... bytes remaining to read for a short body, and curl: (52) Empty reply from server when the connection is closed with no answer.
  • Check the proxy or load-balancer logs for the same request: they often show the cause (timeout, worker killed).

How to fix it

There are two usual causes:

  1. The server or a layer in front of it is wrong (more likely). A worker is killed mid-answer, a proxy cuts off, a handler raises after it has started sending. Fix the lifecycle (graceful shutdown, longer timeouts, an error that happens before sending starts).
  2. The label is wrong (for the gzip case). The body is not compressed but says it is. Fix the header or the compression step.

The spec is not the cause. Never raise the client timeout just to hide it.

AC-010 The body is not valid JSON, or is empty, AC-016 Malformed JSON that parsers read differently, AC-049 The server never answers.

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

2. How clrsig helps

Check

CS-RUN-003 No response: the server did not answer (connection refused, timeout, TLS error, or a failed read). State: caught. Severity today: failure (exit code 1). The sandbox pins these cases with the message reading response body: unexpected EOF for the truncated body and EOF for the reset.

Command

--paths limits the run to these three GET operations, so nothing is written:

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8080/conform-fail \
  --env clrsig/environments/conform-fail.yaml \
  --paths /timeout/truncated-body,/timeout/connection-reset,/hostile/gzip-lie \
  --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 73 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 /timeout/truncated-body,/timeout/connection-reset,/hostile/gzip-lie

  FAIL  GET     /hostile/gzip-lie
         error: reading response body: unexpected EOF
         → [CS-RUN-003] The server did not answer. Why: The connection closed early or the body could not be read (for example a Content-Length or Content-Encoding that does not match what was sent), so there was nothing to compare with the spec. Where: network. Fix: Fix how the server frames this response: the Content-Length, the Content-Encoding (such as gzip) and the connection handling.
  FAIL  GET     /timeout/connection-reset
         error: executing request: Get "http://localhost:8080/conform-fail/timeout/connection-reset": EOF
         → [CS-RUN-003] The server did not answer. Why: The connection closed early or the body could not be read (for example a Content-Length or Content-Encoding that does not match what was sent), so there was nothing to compare with the spec. Where: network. Fix: Fix how the server frames this response: the Content-Length, the Content-Encoding (such as gzip) and the connection handling.
  FAIL  GET     /timeout/truncated-body
         error: reading response body: unexpected EOF
         → [CS-RUN-003] The server did not answer. Why: The connection closed early or the body could not be read (for example a Content-Length or Content-Encoding that does not match what was sent), so there was nothing to compare with the spec. Where: network. Fix: Fix how the server frames this response: the Content-Length, the Content-Encoding (such as gzip) and the connection handling.

No operation got an answer from http://localhost:8080/conform-fail (the error under each operation says why).

FAILED  76 operations  ·  0 passed  ·  3 failed  ·  73 skipped  30ms

How to read it: each operation is reported as “no response”, and the error: line under it gives the real reason: unexpected EOF for a body that ended too early, EOF for a connection closed with no answer. The Why and Fix lines now depend on the kind of error: for a body that could not be read they point at how the response is framed (Content-Length, Content-Encoding, the connection). The connection reset gets the same advice: no readable answer arrived. (Up to 0.16.0 it was called a timeout, because this address contains timeout.)

Where to look

  • Desktop app: Check Conformance lists these operations as failed with the same explanation.
  • Reports: with --format json, each finding has "checkId": "CS-RUN-003".
  • GitHub Action: it runs the same command.

How clrsig helps you fix it

It tells you that no complete answer arrived and where (the network). It does not tell you which of several causes is yours.

Limits

  • The Why and Fix lines are the same for a body cut off and a connection closed with no answer. Read the error: line to tell them apart, and use curl -sS to see the exact error.
  • clrsig does not say whether a retry would be safe.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-017 · The body is cut off, or the connection drops
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a broken connection is not a status code, so status-based alarms do not see it; a service can look healthy while users get broken answers.
Open with this story: A client asks for a report. The server sends the status line and the headers, promises a body of a certain length, and sends only part of it before the worker is killed by a deploy. The client waits, then fails with unexpected end of file. The server's own logs show a normal 200.
Say these facts, in this order:
1. Three fixtures: a body that ends before its announced length, a connection closed without a response, and a body labelled gzip that is not gzip.
2. clrsig reports each as no response, with the check ID CS-RUN-003; the real reason, unexpected EOF, is in the error line under each operation.
3. The Why and Fix lines depend on the kind of error: a body that could not be read points at Content-Length, Content-Encoding and the connection. A connection reset gets the same Why line; read the error line to tell the two apart.
4. Usual causes: a worker killed mid-answer, a proxy that cuts off, a handler that raises after it started sending, deploys and idle timeouts.
5. For managers: status dashboards miss this; a service can look healthy while users get broken downloads.
6. For DevOps: look at the proxy and load-balancer logs, not only the application.
7. Do not raise the client timeout just to hide it.
Show on screen: the three fixture lines, the command (clrsig conform specs/conform-fail.yaml -b http://localhost:8080/conform-fail --env clrsig/environments/conform-fail.yaml --paths /timeout/truncated-body,/timeout/connection-reset,/hostile/gzip-lie --explain), and the output block, copied exactly from the card.
Name the check: CS-RUN-003, No response. Say the clrsig version: v0.21.0.
Explain these words once: connection reset (the other side closes the connection abruptly); truncated (cut off before the end); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: which cause is yours; whether a retry would be safe; the explanation is the same for a cut-off body and a reset connection.
Safety line (if a write is shown): not needed, this command sends GET requests only.
Finish with three recap questions:
1. Why do status dashboards miss this? (A broken connection is not a status code.)
2. Where is the real reason in the output? (In the error line under each operation.)
3. Where do you look for causes? (The proxy and load-balancer logs.)
Tease the next video: AC-018 · A response grows too large.
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.