# RuntimeError: No route matches for path '/api/items/123'

- **ID:** `python/starlette-runtimeerror-no-route-match`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The requested URL path does not match any defined route in the Starlette application.

## Version Compatibility

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

## Workarounds

1. **Define a route with path parameter.** (95% success)
   ```
   from starlette.applications import Starlette
from starlette.responses import JSONResponse
app = Starlette()
@app.route('/api/items/{item_id}')
async def get_item(request):
    return JSONResponse({'id': request.path_params['item_id']})
   ```
2. **Add a 404 handler for unmatched routes.** (90% success)
   ```
   from starlette.responses import PlainTextResponse
@app.exception_handler(404)
async def not_found(request, exc):
    return PlainTextResponse('Not Found', status_code=404)
   ```

## Dead Ends

- **Adding a catch-all route without proper order.** — Catch-all routes must be defined last; otherwise they override specific routes. (50% fail)
- **Using regular expression in route path incorrectly.** — Starlette uses path parameters with curly braces, not regex. Misuse leads to no match. (60% fail)
