HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

4xx Client Error Status Codes

These status codes indicate that the client seems to have made an error. The request contains bad syntax or cannot be fulfilled by the server.

TL;DR

4xx errors mean the client made a mistake. These errors occur when the request sent by the client (browser, API client, etc.) is malformed, unauthorized, or requests a resource that doesn't exist. The client needs to modify the request before retrying.

Understanding 4xx Errors

Client error responses are returned when the server believes the client has made an error in the request. Unlike 5xx errors where the fault lies with the server, 4xx errors indicate that the request should be modified before resubmitting.

Common Causes of 4xx Errors

Who is Responsible?

With 4xx errors, the client is responsible for fixing the issue. However, developers must ensure their applications provide clear error messages and handle these errors gracefully.

Complete List of 4xx Status Codes

400
Bad Request
The server cannot process the request due to malformed syntax or invalid request message framing.
401
Unauthorized
Authentication is required and has failed or has not been provided.
402
Payment Required
Reserved for future use. Originally intended for digital payment systems.
403
Forbidden
The client does not have access rights to the content. Unlike 401, the client's identity is known.
404
Not Found
The server cannot find the requested resource. Most common HTTP error.
405
Method Not Allowed
The request method is not supported for the requested resource.
406
Not Acceptable
The server cannot produce a response matching the list of acceptable values in the request headers.
407
Proxy Authentication Required
Authentication is required by the proxy server.
408
Request Timeout
The server timed out waiting for the request from the client.
409
Conflict
The request conflicts with the current state of the server.
410
Gone
The resource is no longer available and will not be available again.
411
Length Required
The request did not specify the length of its content, which is required.
412
Precondition Failed
One or more conditions given in the request header fields evaluated to false.
413
Content Too Large
The request entity is larger than limits defined by the server.
414
URI Too Long
The URI requested by the client is longer than the server is willing to interpret.
415
Unsupported Media Type
The media format of the requested data is not supported by the server.
416
Range Not Satisfiable
The range specified by the Range header field cannot be fulfilled.
417
Expectation Failed
The expectation given in the Expect request header field cannot be met.
418
I'm a teapot
April Fools' joke from 1998. The server refuses to brew coffee because it is a teapot.
421
Misdirected Request
The request was directed at a server that is not able to produce a response.
422
Unprocessable Content
The request was well-formed but contains semantic errors.
423
Locked
The resource being accessed is locked.
424
Failed Dependency
The request failed due to failure of a previous request.
425
Too Early
The server is unwilling to risk processing a request that might be replayed.
426
Upgrade Required
The client should switch to a different protocol.
428
Precondition Required
The origin server requires the request to be conditional.
429
Too Many Requests
The user has sent too many requests in a given amount of time (rate limiting).
431
Request Header Fields Too Large
The server is unwilling to process the request because its header fields are too large.
451
Unavailable For Legal Reasons
The resource is unavailable due to legal reasons (censorship, DMCA takedown).

How to Debug 4xx Errors

For Developers

  1. Check the Response Body: Most 4xx errors include details about what went wrong
  2. Verify Request Headers: Ensure Content-Type, Authorization, and other headers are correct
  3. Validate the URL: Check for typos, incorrect paths, or missing route parameters
  4. Review Authentication: Confirm tokens are valid and not expired
  5. Inspect Request Payload: Validate JSON/XML syntax and required fields
  6. Check Rate Limits: Implement exponential backoff for 429 errors

For End Users

  1. Refresh the Page: Sometimes a simple refresh resolves temporary issues
  2. Check the URL: Make sure you typed the address correctly
  3. Clear Browser Cache: Old cached data can sometimes cause issues
  4. Try Again Later: If you're being rate limited (429), wait a few minutes
  5. Contact Support: If the error persists, contact the website administrator