Skip to content

404 Not Found — Meaning, Common Causes & How to Fix

404 4xx Client Error RFC 9110 §15.5.5

404 Not Found means: The server cannot find the requested resource. Either the URI never existed, or it existed and was removed without a forwarding address. It is the most recognizable status code on the web and the default answer for unknown paths. Client-error 4xx codes mean the request itself is the problem: malformed syntax, missing credentials, forbidden access, a nonexistent resource or a violated precondition. The server is telling the client what to change; retrying the identical request without a fix will reproduce the same error. In practice you will meet 404 when a mistyped or broken url, or a stale bookmark/link; a resource was deleted or moved without a redirect; routing misconfiguration: the app is deployed but the route is not registered. On the client side, check the URL for typos, try the parent path or site search, and update stale links; for APIs, verify the resource id and API version prefix. On the server side, return a helpful 404 page with navigation/search, set up 301s for moved content, and monitor 404 logs to catch broken internal links and routing bugs.

Advertisement
Ad slot · ref-top

When 404 happens

  • A mistyped or broken URL, or a stale bookmark/link
  • A resource was deleted or moved without a redirect
  • Routing misconfiguration: the app is deployed but the route is not registered

How to fix it

On the client

Check the URL for typos, try the parent path or site search, and update stale links; for APIs, verify the resource id and API version prefix.

On the server

Return a helpful 404 page with navigation/search, set up 301s for moved content, and monitor 404 logs to catch broken internal links and routing bugs.

Should you retry?

Not retryable as-is: change the request (credentials, payload, URL) first.

Debugging steps

When 404 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Read the error body first — well-designed APIs name the offending field or missing credential. Then diff your actual request, headers included, against the documented contract. For this code specifically, check whether the most common trigger applies to your situation: a mistyped or broken url, or a stale bookmark/link. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

404 is the web's most common status and a free diagnostic signal: monitoring 404 logs reveals broken internal links, stale external references and routing misconfigurations before users report them.

Examples

Raw HTTP
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 93

{
  "error": "not_found",
  "message": "A mistyped or broken URL, or a stale bookmark/link"
}
curl
curl -i https://api.example.com/v1/resource   # observe the 404 response and its headers
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 404) {
  const problem = await res.json(); // read field-level details
  // fix the request (credentials, payload, URL) — identical retries keep failing
  throw new RequestError(problem);
}
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 404:
    problem = res.json()  # field-level error details
    # correct the request before retrying — identical retries keep failing
    raise RequestProblem(problem)

Frequently asked questions

404 vs 410: what is the difference?

404 means 'not found' with no statement about history; 410 means 'intentionally gone, permanently'. Search engines deindex 410 faster, so use it for deliberate removals.

Why does my SPA show 404 on refresh?

The server does not know client-side routes. Configure a fallback to index.html for non-asset paths (try_files, rewrites) so the router can handle them.

Are 4xx errors always the client's fault?

By contract yes — the server asserts the request must change. In practice servers sometimes misuse 4xx for their own problems (e.g. 400 for internal validation bugs), so read the error body before blaming your client code.

Should I retry 4xx responses automatically?

Generally no: the server says the request must change. Exceptions are 408 (fresh connection), 425 (after handshake) and 429 (after Retry-After). Blind retries of 400/401/403/404 just burn quota.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →