400 bad request
What is a 400 Bad Request Error?
A 400 error is a generic error. It usually indicates that the client is proving bad input before the server even processes it. Another way to think about a bad request is “bad input equals bad output”.
What causes a bad request error?
Well, as mentioned previously, bad input equates to a bad output. So here’s a few examples:
URL requested contains illegal characters
URL addresses must only contain ASCII characters. An illegal character would include any characters outside of the ASCII character set. An example of an illegal character is a space ” “. You cannot have a space in a URL. Instead of the space, it has to be converted it to ASCII characters resulting in %20. Oftentimes, the server will automatically convert the space to %20 in the URL and either serve the page (if it exists) or return a 404 error because the resource doesn’t exist. If the server doesn’t automatically convert illegal characters to ASCII characters, it will return the 400 error indicating that you gave it a bad input.
Corrupted Browser Cache
When you visit a website, the browser will cache the contents of the website locally on your device with an expiration date which is determined by the website’s server. When you return to the website, in the name of speed and efficiency, the browser will look at the local cache first and determine to use it if it has not expired. If the cache cannot be read the browser will return a 400 bad request error..
Corrupted Cookies
When you visit a website, it often will place cookies on your browser to assist with tracking your activity and your previous history of response to consent to terms and so on. Sometimes, these cookie values can get corrupted for various reasons. When the website goes to read the cookie (the input), it responds with a 400 error since the value or key of the cookie is malformed.
General Error
When the server doesn’t know how to categorize the error, the 400 error is often the default catch-all. If you have exhausted all of the above reasons, then it’s possible that the software or web developer just used the 400 error as a way to just send and error.
Related 4XX Client Errors
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Payload Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I’m a teapot
- 421 Misdirected Request
- 422 Unprocessable Entity (WebDAV)
- 423 Locked (WebDAV)
- 424 Failed Dependency (WebDAV)
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request