Skip to content

Query does not enforce the key value size limits: 2048 bytes for the hash key, 1024 bytes for all range keys together #435

Open

Description

@LeeroyHannigan

Summary

The service refuses a Query whose key condition carries a partition key value over 2048 bytes, or range key values whose sizes add up to more than 1024 bytes, with a ValidationException. ExtendDB runs the query and returns 200 with no items.

Measured

2026-10-21, us-east-1, Query against a GSI with HASH h and RANGE a, b, c, d, all type S. ExtendDB is main (ec81e9d) on SQLite and PostgreSQL.

key condition service ExtendDB
h = :big with a 2049-byte value 400 ValidationException: One or more parameter values were invalid: Size of hashkey has exceeded the maximum size limit of2048 bytes 200, no items
h = :h AND a = :big1025 with a 1025-byte value 400 ValidationException: One or more parameter values were invalid: Aggregated size of all range keys has exceeded the size limit of 1024 bytes 200, no items
h = :h AND a = :s600 AND b = :b AND c = :s600 with two 600-byte values 400 ValidationException: One or more parameter values were invalid: Aggregated size of all range keys has exceeded the size limit of 1024 bytes 200, no items (on main this shape is refused earlier as Query condition missed key schema element: h; after #429 it runs)

Base table with HASH pk and RANGE sk, both S, measured 2026-10-22 on the service and on main SQLite:

key condition service ExtendDB
pk = :v, 2048-byte value 200 200
pk = :v, 2049-byte value 400, the hash key message above 200
pk = :p AND sk = :v, 1024-byte value 200 200
pk = :p AND sk = :v, 1025-byte value 400, the range key message above 200
pk = :p AND sk BETWEEN :l AND :h, two 600-byte bounds 200 200

So the limits are 2048 inclusive and 1024 inclusive, and the two bounds of one BETWEEN are not added together. The service's hash key message has no space between of and 2048. The range key limit is the sum over every RANGE attribute with a condition, so two 600-byte values on a multi-attribute index exceed it while each alone does not.

Expected

The three refusals above, with the service's text. PutItem already refuses oversized key values on write with its own wording; this is the read-side check on the condition values.

Where

The engine's Query path after the key condition is classified (crates/engine/src/query.rs): sum the byte size of the HASH value and of every RANGE value bound by the condition, and refuse before the storage call. Which other refusals the size check follows is not measured here; the shapes above carry no other error.

Activity

  1. added this to the 1.0 milestone on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions