When it comes to choosing the correct 4xx error code, it could be confusing. I found this diagram helps me a lot whenever I need to pick the http status code to response.

如何确定正确的 HTTP 返回码

资料来源 Cecile Peraire & Hakan Erdogmus, Carnegie Mellon University – Foundations of Software Engineering

图片原作者 Alan Dean