# fastapi.exceptions.RequestValidationError: value is not a valid integer

- **ID:** `python/fastapi-query-param-validation-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A query parameter expected to be an integer is provided as a non-numeric string or missing.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Use type hints: def read_item(item_id: int = Query(...)):
   ```
2. **** (90% success)
   ```
   Catch RequestValidationError and return a custom message.
   ```

## Dead Ends

- **** — Using int() conversion in the function body can raise ValueError instead of a proper validation error. (70% fail)
- **** — Setting a default value of 0 masks the error but allows invalid data. (60% fail)
