Aggregated size of all range keys has exceeded the size limit of 1024 bytes
TL;DR — DynamoDB limits a sort (range) key to 1024 bytes and a partition (hash) key to 2048 bytes (UTF-8 encoded, plus the attribute-name length). 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: Aggregated size of all range keys has exceeded
the size limit of 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, including the attribute name) can be at most 1024 bytes; the partition key at most 2048. Cross it and the write is rejected with an HTTP 400 ValidationException — client-side, 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.
- A long attribute name on the key — the name counts toward the byte budget too.
- 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).
- Shorten the attribute name if it's verbose — it's part of the key's byte count.
- Measure in bytes, not characters — UTF-8 encode and count, especially for non-ASCII data.
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