Error: dynamodb the parameter cannot be converted to a numeric value

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
“The parameter cannot be converted to a numeric value” means a value supplied as DynamoDB Number is not valid numeric text or is outside DynamoDB’s supported precision and range. Decimal fractions are supported. The correct representation depends on whether you use a low-level or document API.
- Low-level API: use
{"N":"12.5"}. The string is the wire representation of a Number;{"S":"12.5"}stores a String instead. - JavaScript document client: pass a finite native number, such as
12.5, not an AttributeValue wrapper. Validate user input before coercion. - Boto3 Table resource: use
Decimal("12.5")for fractional values. Python floats are rejected by boto3’s DynamoDB serializer. - Reject empty input, NaN, infinity, booleans used as numbers, and formatted strings such as currency amounts or comma-separated digits.
from decimal import Decimal
import boto3
amount = Decimal("12.50")
if not amount.is_finite():
raise ValueError("Amount must be finite")
table = boto3.resource("dynamodb", region_name="us-east-1").Table("Orders")
table.put_item(Item={"pk": "ORDER#123", "sk": "DETAIL", "amount": amount})DynamoDB supports up to 38 digits of numeric precision. Avoid converting exact decimal strings through a binary floating-point value first, which can lose precision before DynamoDB sees the data. If a key is defined as Number, changing its request value to String will cause a key-type mismatch rather than fix the numeric input.
See DynamoDB data types and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- accessdeniedexception dynamodb
- dynamodb localhost not working
- dynamodb mapper save not persisting
- failed to begin subsegment named 'amazondynamodbv2': segment cannot be found.
- AWS CLI DynamoDB Error Parsing Parameter
- Unable to start DynamoDB Local process
- Float types are not supported. Use decimal types instead.
- Boto3 DynamoDB KeyError
- DynamoDB Errors InvalidSignatureException Signature Expired
- DynamoDB is not showing all columns
- dynamodb global secondary index not working
- dynamodb cannot read property 's' of undefined
- DynamoDB scan does not return all items
- dynamodb unable to parse base64 string
- DynamoDB error 400
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today