The 400 bad request is an error that is a member of the 4XX status codes.
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 wya to think about a bad request is “bad input = 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..
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.
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.