# pydantic_core._pydantic_core.ValidationError: 1 validation error for Price
value
  Decimal input should have no more than 2 decimal places [type=decimal_max_places, input_value='1.2345', input_type=str]

- **ID:** `python/pydantic-decimal-max-digits`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A Decimal field declared with max_digits/decimal_places received a value with more fractional digits than allowed.

## Version Compatibility

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

## Workarounds

1. **** (92% success)
   ```
   from decimal import Decimal, ROUND_HALF_UP
v = Decimal('1.2345').quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
Price(value=v)
   ```
2. **** (90% success)
   ```
   from pydantic import BaseModel, field_validator, Field
from decimal import Decimal, ROUND_HALF_UP
class Price(BaseModel):
    value: Decimal = Field(max_digits=10, decimal_places=2)
    @field_validator('value', mode='before')
    @classmethod
    def quantize(cls, v):
        return Decimal(str(v)).quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
   ```

## Dead Ends

- **** — Introduces binary floating-point rounding; 1.2345 becomes 1.2344999... (60% fail)
- **** — Defeats the purpose and allows inconsistent money precision downstream. (50% fail)
- **** — Silently zeroes real prices, causing financial data corruption. (70% fail)
