# fastapi.exceptions.RequestValidationError: 422: Field required

- **ID:** `python/fastapi-requestvalidationerror-query-parameter-missing`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A required query parameter or path parameter was not provided in the request.

## Version Compatibility

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

## Workarounds

1. **Use Optional type with default None.** (95% success)
   ```
   from typing import Optional
from fastapi import FastAPI, Query
app = FastAPI()
@app.get('/items/')
async def read_items(q: Optional[str] = Query(None)):
    return {'q': q}
   ```
2. **Set default value directly.** (90% success)
   ```
   @app.get('/items/')
async def read_items(q: str = 'default'):
    return {'q': q}
   ```

## Dead Ends

- **Adding a default value of None without Optional type.** — Without Optional, FastAPI still treats it as required and will raise validation error if missing. (60% fail)
- **Using Query(None) without Optional.** — Query(None) sets default to None but type hint still requires the field, causing validation error. (70% fail)
