Aggregated size of all range keys has exceeded the size limit of 1024 bytes
TL;DR — DynamoDB limits a sort (range) key value to 1024 bytes and a partition (hash) key value to 2048 bytes (measured UTF-8 encoded). Your sort-key value crossed 1024 bytes — usually an over-stuffed composite key. Shorten it, hash the long part, or move the bulk into a non-key attribute.
What it means
ValidationException: One or more parameter values were invalid: Aggregated size of all range keys has exceeded the size limit of 1024 bytes
# on DynamoDB Local you get one combined sentence instead, naming neither key:
ValidationException: Hash primary key values must be under 2048 bytes, and range primary key values must be under 1024 bytesThis is a hard key-size limit, separate from the 400 KB item limit. The sort key's value (measured as UTF-8 bytes) can be at most 1024 bytes; the partition key's value at most 2048. Cross it and the write is rejected with an HTTP 400 ValidationException — a request error that is not retryable until the key is smaller.
Why it happens
- Over-long composite sort keys — concatenating many segments (
ORG#…#PROJECT#…#DOC#…#veryLongTitle…) until the value exceeds 1024 bytes. - Encoding a large value into the key — putting a full URL, path, description, or serialized blob into the sort key.
- Multibyte characters — non-ASCII text costs 2–4 bytes each in UTF-8, so a "short-looking" string can be over the byte limit.
- Partition key too big — the same class of error against the 2048-byte hash-key limit.
How to fix it
- Trim the composite key to just the segments you actually query on; drop human-readable filler.
- Hash the long portion — store a short deterministic digest (e.g. a truncated SHA-256) in the key and keep the full value as a normal attribute.
- Move bulk out of the key — the sort key should identify/order the item, not carry its payload; put long text in a non-key attribute (which enjoys the 400 KB item budget).
- Measure in bytes, not characters — UTF-8 encode and count, especially for non-ASCII data.
See it in DynoTable
Paste a draft item into the item size calculator and check key attribute byte counts before you write. In DynoTable, open the table with ⌘K, create a test item with staging (⌘S), and confirm the key fits — oversized keys fail before commit.
When redesigning composite keys, prototype queries in the Query Builder with shorter key segments. Switch profiles with ⌘P; Test Connection on Settings → Profiles. See Connect to AWS and Install.
Sources
- Supported data types and naming rules (verified 2026-07-13)
- BatchWriteItem — Amazon DynamoDB API Reference (verified 2026-07-13)
Related errors
- Item size has exceeded the maximum allowed size (400 KB) — the whole item, not just the key, is too big.
- The provided key element does not match the schema — a key type/shape mismatch.
- Learn: DynamoDB item size limit
References
- Supported data types and naming rules in Amazon DynamoDB — Developer Guide
- BatchWriteItem — Amazon DynamoDB API Reference (key length limits)
- Error handling with DynamoDB — Amazon DynamoDB Developer Guide
Last verified 2026-07-13 against the official AWS documentation linked above.