# AttributeError: 'Query' object has no attribute 'default'

- **ID:** `python/fastapi-attribute-error-no-attribute-query`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using `Query(default=...)` in a Pydantic v2 / FastAPI version where the parameter was renamed to `default` only in newer releases, or mixing `Query()` with `Annotated` incorrectly.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.95.x | active | — | — |
| 0.100.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Use the modern form: `q: Annotated[str | None, Query(max_length=50)] = None`
   ```
2. **** (90% success)
   ```
   Or the older positional style: `q: str = Query(None, max_length=50)` (no `default=` keyword).
   ```

## Dead Ends

- **** — Downgrade breaks Pydantic v2 compatibility and other features. (80% fail)
- **** — Fragile across versions and breaks OpenAPI generation. (90% fail)
