# pydantic_core._pydantic_core.ValidationError: 1 validation error for Model
age
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='abc', input_type=str]

- **ID:** `python/pydantic-type-error-int-parsing-string`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Pydantic v2's stricter parsing rejects non-numeric strings for `int` fields where v1 would silently coerce or raise a different message.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Use a custom validator: `@field_validator('age', mode='before')
@classmethod
def parse_age(cls, v):
    return int(v) if str(v).isdigit() else 0`
   ```
2. **** (88% success)
   ```
   Change the field type to `Union[int, str]` and validate downstream, or use `Annotated[int, BeforeValidator(lambda v: int(v) if str(v).isdigit() else 0)]`.
   ```

## Dead Ends

- **** — Wrapping in `try/except ValueError` does not catch `ValidationError` in v2 because it is a separate exception type. (75% fail)
- **** — Using `int(value)` before passing to the model defeats the purpose and still raises for non-numeric input. (60% fail)
