Skip to content

400 vs 431

Bad Request vs Request Header Fields Too Large

400Bad Request

Huh? The server is scratching its head because your request doesn't make sense. Like ordering a pizza with negative toppings.

HTTP Response
HTTP/1.1 400 Bad Request
Content-Type: application/json

{"error": "Invalid request format"}

431Request Header Fields Too Large

TMI in the headers! You're sending so much metadata that the server's eyes glazed over. Trim those headers down!

HTTP Response
HTTP/1.1 431 Request Header Fields Too Large
🀨400Bad Request
πŸ“‹431Request Header Fields Too Large
Description

The server cannot process the request due to client error (malformed syntax, invalid request framing, etc.).

When to Use
  • Request is syntactically malformed (invalid JSON, wrong content-type)
  • Required parameters are missing entirely
  • Use 422 instead when syntax is valid but semantically incorrect
Common Causes
  • Malformed JSON in request body
  • Missing required fields
  • Invalid query parameters
Description

The server is unwilling to process the request because its header fields are too large.

Common Causes
  • Cookie header too large
  • Too many custom headers
  • Excessively long header values