StoicBuilder

HandbookII the ForumHTTP status codes

IIthe Forum, The shape of an app

HTTP status codes

1 min readUpdated 28 November

In plain words

A status code is the three-digit number on every server reply: 2xx means it worked, 4xx means the request had a problem, 5xx means the server broke.

Where you see it

The red rows in the Network tab, the "404 | This page could not be found" screen in Next.js, and the 500s in your Vercel logs. The number tells you which side to blame before you read a word of the error.

Terminalterminal
$ curl -i http://localhost:3000/api/orders/999HTTP/1.1 404 Not Foundcontent-type: application/json {"error":"Order not found"}
The status is the first line of every reply. Everything after it is detail.

What goes wrong

  1. Saying 200 OK with an error inside

    The server replies with a success code and an error message in the body. The browser sees success and shows the confirmation page.

    return Response.json({ error: "Payment failed" }); // still 200
  2. One message for every failure

    401 means sign in, 403 means not allowed, 404 means it isn't there and 500 means the server crashed. "Something went wrong" for all four hides the fix.

  3. Fixing the browser when the server is broken

    A 5xx means the bug is on the server. Point your agent at the server logs instead of letting it restyle the button again.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Make every API route return the right status code: 400 for bad input, 401 when not signed in, 403 when not allowed, 404 when missing and 500 only for real crashes. Show the user a different message for each.

Quick check

Sign in to earn +10 XP for it

A Guildhall member gets a 403 when opening the admin page. What does it mean?

Got a prompt that touches HTTP status codes?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.