# starlette.exceptions.HTTPException: 404 Not Found

- **ID:** `python/starlette-http-exception-404`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A route is not defined for the requested URL, or the URL is incorrect due to routing mismatches.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Check app.routes to see registered routes and ensure the path matches exactly, including trailing slashes.
   ```
2. **** (80% success)
   ```
   Add a catch-all route: @app.route('/{path:path}')\nasync def catch_all(request):\n    raise HTTPException(status_code=404)
   ```

## Dead Ends

- **** — Catching all HTTPExceptions and returning a custom page can mask other errors like 500s. (50% fail)
- **** — Using regex patterns incorrectly in route paths can cause unexpected 404s. (70% fail)
