1. The problem
In one sentence
Different endpoints answer the same kind of error in different shapes, and some do not match the one shape the spec declares.
A story
The spec declares one Error shape for every 404: {"error": "…"}. Three engineers wrote three handlers. GET /users/999 answers {"message": "user not found"}. GET /orders/999 answers {"code": 404, "msg": "not found"}. GET /products/999 answers {"error": "not found"}, which is right by accident. A client reads response.error and shows it. For users and orders it gets nothing, and shows a blank message.
Why it hurts
Error handling is written once, against the spec, and reused for every endpoint. It works for the endpoints that follow the spec and fails silently for the others, usually at the moment a user already has a problem.
- For developers: error code is the least tested code, so the differences stay hidden until production. The cause is often copy-paste from another service.
- For managers: customers who hit an error see no explanation, which turns a small failure into a support call.
- For DevOps: error answers are easy to forget in a check run. Include the error cases (an unknown id) so the check covers them.
Example
The spec declares this for every 404:
Error:
type: object
required: [error]
properties:
error: { type: string }
The broken server answers:
GET /users/999 -> {"message": "user not found"}
GET /orders/999 -> {"code": 404, "msg": "not found"}
GET /products/999 -> {"error": "not found"}
Only the third matches.
The same family of problem appears when a list is returned as a bare array where the spec declares an object with items and count (failure-catalog demo FM-010-03). Then clrsig reports value must be an object (AC-006 shows the type check).
How to detect it without clrsig
- Call each error path (
curl -i URL/999) and compare the body with the declared error shape. - In a review, search for the places where an error body is built, and count the different shapes.
How to fix it
There are two usual causes:
- The code is wrong (more likely). Use one shared error helper for the whole service and replace the ad-hoc bodies.
- The spec is wrong. Some endpoints deliberately use another error format. Declare it per endpoint.
To tell which: ask which shape clients already read. Never silence the check.
Related problems
AC-005 A required field is missing, AC-006 A field has the wrong type, AC-001 The server answers a status the spec never listed. Failure-catalog demos: FM-010-02 and FM-010-03. See also the site’s OpenAPI Specification and Implementation Drift.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
CS-RESP-005 Required body field missing: the error field of the declared shape is not in the body. State: caught. Severity today: failure (exit code 1). The demo runs it as a scenario with the spec attached, and each step is checked against the declared Error shape.
Command
This demo is a runnable server in the failure catalog. It only reads data (GET). From the demo folder, with Go installed:
cd failures/fm-010-02-error-schema
go run broken/main.go &
clrsig run scenarios/detect.yaml --env environments/local.yaml
Exit code: 0 clean, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1. Run it again against fixed/main.go: all three steps pass and the exit code is 0.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: fm-010-02 — Inconsistent Error Response Schema
FAIL GET /users/999 — 404 error body must match declared Error schema 404 13ms
✓ status eq 404
✗ schema: Error at "/error": property "error" is missing
→ [CS-RESP-005] "error" is missing from the response. Why: The spec marks "error" as required, but the server's response did not include it. Where: response body, field error. Fix: Return "error" from the server, or make it optional in the spec if it is not always present.
SKIP GET /orders/999 — 404 error body must match declared Error schema
skipped: step 1 (GET /users/999 — 404 error body must match declared Error schema) failed and its failPolicy is stop; set failPolicy: continue to run the steps after a failure
SKIP GET /products/999 — 404 error body must match declared Error schema
skipped: step 1 (GET /users/999 — 404 error body must match declared Error schema) failed and its failPolicy is stop; set failPolicy: continue to run the steps after a failure
FAILED 0 passed, 1 failed, 2 skipped (1/2 assertions passed) 14ms
How to read it: the status was right (✓ status eq 404), but the body has message and not error. The failed schema check carries its check ID, CS-RESP-005, with why and fix. The other two steps were skipped, and the output says why: step 1 failed and its failPolicy is stop. Set failPolicy: continue to run them. The second bad shape (GET /orders/999) is not shown until you do.
Where to look
- Desktop app: open the scenario from the demo and run it; the failed assertion shows the same finding.
- Reports: use
--format jsonorjunitonclrsig run; the failed assertion is part of the step. - GitHub Action: use
command: runwith thescenarioandenvinputs. The demo’s scenario names its spec withspecFile, so responses are compared with it. To compare your own responses with your spec, name it withspecFilein the scenario, or give thespecinput, which replaces it; older releases of the Action ignored that input withrun(setup and upgrading).
How clrsig helps you fix it
It names the field that is missing and says the fix may be in the code or in the spec. It does not print the body, so call the operation yourself to see the whole shape. It does not tell you which of the other endpoints are wrong.
Limits
- After the first failing step, the later steps are skipped, and the output says why. Set
failPolicy: continueto run them, or fix and run again. - The check can only compare against the shape the spec declares for that response.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-014 · Every error answers in a different shape
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: if the spec declares one shape for errors, every endpoint must use it, because the client's error handling is written once.
Open with this story: The spec declares one Error shape for every 404, with a field called error. Three engineers wrote three handlers. One answers with a field called message, one with a numeric code and a field called msg, and one, by accident, with error. A client that reads the error field shows a blank message for two of them.
Say these facts, in this order:
1. The spec declares a body with a field called error. The users endpoint answers with a field called message instead.
2. Error handling is written once against the spec and reused for every endpoint, so it fails silently for the ones that differ.
3. Error code is the least tested code; copy-paste from another service is a common cause.
4. To find it without clrsig: call each error path and compare the body with the declared error shape.
5. The demo runs a scenario with the spec attached: each step checks its status, and its body against the declared Error shape.
6. In the output, the status check passes. The schema check fails: the property error is missing. The line with the arrow gives the check ID, why it fails, where it is, and how to fix it. clrsig does not print the body, so call the operation yourself to see the whole shape.
7. The first failing step stops the run because its fail policy is stop. The other two steps are shown as skipped, with the reason. Set the fail policy to continue, or fix and run again, to see the next bad shape.
8. Two usual causes: the code is wrong (use one shared error helper), or some endpoints deliberately use another format and the spec should declare it per endpoint. To tell which: ask which shape clients already read. Never silence the check.
9. The same family of problem appears when a list comes back as a bare array where the spec declares an object with items and count.
10. For managers: customers who hit an error see no explanation, which turns a small failure into a support call.
11. For DevOps: include the error cases, such as an unknown id, in your checks.
Show on screen: the Error schema; the three answers; the commands (cd failures/fm-010-02-error-schema, go run broken/main.go and clrsig run scenarios/detect.yaml --env environments/local.yaml); and the output block, copied exactly from the card.
Name the check: CS-RESP-005, Required body field missing. Say the clrsig version: v0.21.0.
Explain these words once: schema (the part of the spec that describes the shape of a body); scenario (a script of steps with your own checks, called assertions); fail policy (what happens to later steps when one fails); exit code (0 clean, 1 a finding, 2 the setup or the spec is broken).
Say what clrsig does not see here: later steps are skipped after a failure when the fail policy is stop, and the output says why; it compares only with the shape the spec declares; it does not tell you which other endpoints are wrong.
Safety line (if a write is shown): not needed, the demo only sends GET requests.
Finish with three recap questions:
1. Which field did the spec declare for the error? (error.)
2. Why does the run show only one bad endpoint? (The later steps were skipped because the first failed and its fail policy is stop.)
3. What is the common fix in the code? (One shared error helper.)
Tease the next video: AC-015 · Fields are renamed, removed or re-cased.
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.