Number overflow. Attempting to store a number with magnitude larger than supported range

TL;DR — Your number is outside DynamoDB's limits. The N type holds up to 38 digits of precision with a magnitude between roughly 1E-130 and 9.9999…E+125. A value past that range (or one that lost precision beyond 38 digits) is rejected. Store big IDs and high-precision values as strings, not numbers.

What it means

ValidationException: Number overflow. Attempting to store a number with magnitude larger than supported range

DynamoDB's Number type is a decimal with a bounded range and 38 significant digits. This ValidationException (HTTP 400) means the value you sent exceeds that magnitude — or a language runtime turned a long numeric string into a floating-point number that overflowed the range. It's not retryable as a number; the value has to be represented differently.

Why it happens

  • A genuinely huge number — a value larger than ~`9.9E+125(or a positive value smaller in magnitude than1E-130`).
  • A long numeric string parsed to a float — e.g. a 120-digit account/reference number run through Number() / parseFloat() becomes something like 8.04e+126 and overflows. This is a frequent real-world trigger.
  • More than 38 significant digits — the value can't be represented exactly by DynamoDB's Number type.
  • A computed value (a product, an exponentiation) that grew past the range.

How to fix it

  1. Store it as a string (S), not a number. Large identifiers, account numbers, or hashes that you never do math on should be strings — this sidesteps both the magnitude limit and the 38-digit precision cap.
  2. Don't parse ID-like strings to numbers — keep a 100-digit reference as a string end-to-end. Parsing it to a float is what produces the overflow.
  3. Keep numeric attributes inside the range — DynamoDB Number supports up to 38 digits of precision and magnitude to ~`9.9E+125`. Design values to fit, or split/scale them.
  4. For high-precision decimals, pass numbers as strings you convert from your decimal type (Python Decimal, a big-decimal library) so precision isn't lost before it reaches DynamoDB.
  5. Preserve leading zeros / exactness by storing as a string — the Number type normalizes and can't keep leading zeros anyway.

FAQ

What are DynamoDB's number limits? The Number type supports up to 38 digits of precision and a magnitude from about 1E-130 to 9.9999999999999999999999999999999999999E+125 (positive) and the negatives of those. A value outside that range raises "Number overflow."

How do I store a very large number in DynamoDB? Store it as a string (S) attribute rather than a Number (N) if you don't do arithmetic on it — this avoids the 38-digit precision cap and the magnitude limit entirely. For sortable numeric strings, zero-pad them so lexical order matches numeric order.

Mit DynamoDB ohne die Console arbeiten

DynoTable ist ein schneller Desktop-Client für DynamoDB — durchsuche Tabellen, führe SQL-artige Queries aus und bearbeite Items lokal.