AI-generated summary
The discussion revolves around the HTTP status code that should be returned when a user visits an absent tag page. dmitry_fedyuk initially suggests that a 404 status code is more suitable, citing Wikipedia’s definition of a 404 error. downey disagrees, suggesting that a 204 status code might be more fitting, as it indicates that the server has processed the request but has no content to return.
However, fefrei counters that a 204 status code is more suitable for a search with no results, whereas a 404 status code is more suitable for a request for a specific topic that does not exist. codinghorror agrees with fefrei and suggests that neil add this to his list on tagging.
neil initially agrees with downey but later changes his mind and agrees with fefrei. riking also points out that a 204 status code is incorrect, as it implies a Content-Length of 0.
neil updates that the 200 status code was previously used to indicate that the tag name was valid but had no tagged content. However, he now agrees that a 404 status code is more helpful, as it indicates that the tag does not exist. The change has been implemented, but neil notes that it’s still possible to get a 200 response with an empty topic list when filtered by both a category and an existing tag.
At first this sounds good, but I’m not so sure. There is semantic knowledge in seeing that no posts exists for a tag. Does Google return a 404 when no results are returned from a search?
Google returns “204” code:
204 No Content
The server successfully processed the request and is not returning any content.
That was what I was thinking about … Not sure if it’s 100% accurate either but looks like the best fit for this scenario…
I think a 404 is more appropriate here.
204 means “your request was processed okay, and there is no result to show you”. That’s good for a search with no results, because you got what you asked for, it just turned out to be empty.
404 means “what you’re looking for never existed or no longer exists”, which seems more suitable for a request for a specific topic (which turned out not to exist).
Sure sounds good @neil can you add this to your list on tagging?
I also wasn’t sure if a 20x or 40x error was better, but I now agree that 404 is better. On my list!
204 is certainly wrong - 204 means you have a Content-Length of 0, i.e. no bytes returned.
The 200 was ok I guess, because it meant that it was a valid tag name but nothing had been tagged with it yet. It’s more helpful to say 404 because the tag doesn’t exist.


