How to fix NUMBER_OUTSIDE_VALID_RANGE in Salesforce deployments
A numeric field value on a record being saved exceeds the digits or decimal places defined for that field.
Surfaces during: runtime DML, in data loads, Apex tests, and formula or rollup evaluationWhat it means
NUMBER_OUTSIDE_VALID_RANGE fires when a value written to a Number or Currency field has more digits, or more decimal places, than the field's precision and scale allow. Salesforce defines those limits on the field itself, so any value outside them is rejected at save time regardless of where it came from.
Precision and scale are set at field creation and are notoriously hard to widen later without a support case in some editions, so this error often points at a field definition that was undersized for the data it now needs to hold, not just a one-off bad value.
Common causes
The fix
- Round or truncate values before loadingAdjust the migration or transform step to match the destination field's exact precision and scale before insert.
Decimal rounded = rawValue.setScale(2, System.RoundingMode.HALF_UP); - Widen the field if the extra precision is legitimateIncrease the field's decimal places or digit count in Setup if the business genuinely needs that level of detail.
- Check formula outputs against the field definitionConfirm any formula or rollup summary feeding the field can't produce a value that exceeds its numeric limits.
How Serpent prevents this
Serpent's pooled scratch orgs share the same field definitions as the branch under test, so a migration script producing out-of-range values fails fast in an isolated environment instead of during a shared sandbox load. See the Salesforce deployment error library.

Prevention
Related errors
NUMBER_OUTSIDE_VALID_RANGE, answered
Start free. No credit card, no install, no commitment.
Set up in under 15 minutes. No DevOps hire needed.
