1. The problem
In one sentence
The server answers a business problem (not found, invalid input) with a status that says something else, such as 200 OK for a missing product or 500 for a bad request.
A story
A client asks for product 9999, which does not exist. The server answers 200 OK with the body {"error":"not found","code":"PRODUCT_NOT_FOUND"}. The body is honest, but the status says success. The load balancer, the cache and the monitoring all count it as a success. A second endpoint answers 500 Internal Server Error when a required field is missing from a request, as if the server had crashed, when the client had made a mistake.
Why it hurts
The status is the part of the answer that everything between the client and the server reads: proxies, caches, retry logic, circuit breakers, dashboards and alerts. A wrong status misleads all of them at once.
- For developers: a
200with an error body forces every client to read the body to learn whether the call worked. A500for a client mistake makes clients retry, and makes the team think the service is broken. - For managers: a
5xxrate that includes client mistakes looks like an outage. A200rate that includes failures hides real ones. Both make the service’s health numbers wrong. - For DevOps: a not-found cached as a success is served again and again. A
500for validation triggers alerts and retries for a problem that no retry can fix.
Example
Two demos from the failure catalog, each with a small server:
GET /products/9999 -> 200 {"error":"not found","code":"PRODUCT_NOT_FOUND"} (should be 404)
POST /products {"price":9.99} -> 500 (should be 422: the name is missing)
How to detect it without clrsig
curl -s -o /dev/null -w '%{http_code}\n' URLfor a thing that does not exist, and for a request with a missing field.- In the access logs, count the statuses per route and look for
200on routes whose bodies contain"error".
How to fix it
There are two usual causes:
- The code is wrong (more likely). A uniform error handler returns
200, or an unhandled validation error falls through to the500handler. Map each kind of error to its status:404for not found,400or422for invalid input,409for a conflict. - The spec is wrong or silent. The spec never says which status goes with which error. Declare them, so clients and tests have something to check against.
To tell which: ask what a client should do next. If it should not retry, it is a 4xx. Never leave the status as 200 just because the body explains it.
Related problems
AC-001 The server answers a status the spec never listed, AC-035 Authentication error codes are mixed up, AC-038 Valid shape, wrong meaning. More failure-catalog demos for the same family: FM-025-05 (an empty result returns 404) and FM-025-06 (a page out of range returns 500). See also the site’s Incorrect HTTP Status and Business-Error Semantics.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
No built-in check, and the state is not caught. A 200 is a status the spec may well declare, and the body can match its schema, so the response checks pass. clrsig sees the problem when a scenario step asserts the correct status.
Command
Each demo is a runnable server in the failure catalog, with a scenario that asserts the right status. The second demo sends a POST, so it writes to its own local toy server:
Safety. Run this against a test server, never production.
clrsig conformsendsPOST,PUTandDELETErequests built from the spec: start with--read-only, and take secrets from the environment (${NAME}), never from files in the repository.
cd failures/fm-025-01-incorrect-status
go run broken/main.go &
clrsig run scenarios/detect.yaml --env environments/local.yaml
Exit code: 0 all steps pass, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1. Run it again against fixed/main.go: both steps pass and the exit code is 0.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30. First, fm-025-01-incorrect-status:
Scenario: fm-025-01 — Incorrect HTTP Status and Business-Error Semantics
PASS existing product returns 200 200 17ms
✓ status eq 200
FAIL missing product must return 404 200 0ms
✗ status eq 404: expected "404"; got "200"
FAILED 1 passed, 1 failed, 0 skipped (1/2 assertions passed) 17ms
Then fm-025-04-validation-error-code (run from its own folder in the same way):
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: fm-025-04 — Validation Error Returns 500 Instead of 422
FAIL POST with missing name — must return 422, not 500 500 13ms
✗ status eq 422: expected "422"; got "500"
FAIL POST with missing price — must return 422, not 500 500 0ms
✗ status eq 422: expected "422"; got "500"
FAILED 0 passed, 2 failed, 0 skipped (0/2 assertions passed) 13ms
How to read it: the normal call passes. The failing step names what it expected and what it got. In the second demo both steps fail, so both bad requests are shown.
Where to look
- Desktop app: open the scenario and run it; each step shows its assertions.
- Reports:
--format jsonandjunitonclrsig runlist the failed assertions. - GitHub Action: use
command: runwith thescenarioandenvinputs. The demos check with their own assertions. 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 shows the status you got and the status the scenario says is right. It does not know which status is right for your API: you write that down in the assertion, which is also the contract for the next person.
Limits
- The assertions test only the cases you write. Add one per error your API can return.
- Whether the steps after a failure run depends on the scenario’s fail policy: with
failPolicy: continuethey run, otherwise they are skipped and the output says why. - A green run means nothing is wrong in what was checked.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-034 · The wrong HTTP status for a business error
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: the status is the part of the answer that proxies, caches, retries and dashboards read; a wrong status misleads all of them at once.
Open with this story: A client asks for a product that does not exist. The server answers 200 OK with a body that says not found. The body is honest but the status says success. The load balancer, the cache and the monitoring all count it as a success. A second endpoint answers 500 when a required field is missing, as if the server had crashed, when the client had made a mistake.
Say these facts, in this order:
1. Demo one: a missing product answers 200. The scenario asserts 404, and fails: expected 404, got 200.
2. Demo two: a missing required field answers 500. The scenario asserts 422 and fails: expected 422, got 500.
3. The response checks cannot see it: 200 may be declared, and the body can match its schema. A scenario that asserts the right status can.
4. A 200 with an error body forces every client to read the body; a 500 for a client mistake makes clients retry something no retry can fix.
5. Two usual causes: the code is wrong (map each error kind to its status: 404, 400 or 422, 409), or the spec is silent about which status goes with which error.
6. For managers: health numbers go wrong in both directions.
7. For DevOps: a not-found served as a success can be cached; a 500 for validation triggers alerts.
Show on screen: the two example lines, the commands (go run broken/main.go and clrsig run scenarios/detect.yaml --env environments/local.yaml), and the two output blocks, copied exactly from the card.
Name the check: none built in; the problem is found by a status assertion in a scenario. Say the clrsig version: v0.21.0.
Explain these words once: status code (the number that says how a request went); 4xx (the client made a mistake); 5xx (the server failed); scenario (a script of steps with your own checks, called assertions); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: the assertions test only the cases you write; later steps are skipped after a failure when the fail policy is stop, and the output says why; a green run means nothing is wrong in what was checked.
Safety line (if a write is shown): Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.
Finish with three recap questions:
1. Which status should a missing product answer? (404.)
2. Which status should a missing required field answer? (422, or 400.)
3. Why can the response checks not see the 200 problem? (The status may be declared and the body matches the schema.)
Tease the next video: AC-035 · Authentication error codes are mixed up.
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.