Skip to content

A JSON null in a key, an ExpressionAttributeValues entry, an AttributesToGet element or a batch or transaction item answers SerializationException, where DynamoDB answers ValidationException #1102

Open

Description

@LeeroyHannigan

Amazon DynamoDB refuses a JSON null in each member below with ValidationException. ExtendDB answers each one with SerializationException and serde's text. #1050 covers the same refusal for a PutItem item attribute and for a Scan AttributesToGet element.

Measured in us-east-1 on 17 Nov 2026, on a table keyed on pk (S), with signed requests that carry the JSON bodies below. Each request went out twice and got the same answer both times. The ExtendDB column comes from a SQLite server built from the fix for #1050, which does not change these members. A server built from origin/main 81e3ebe gave the same answer for the seven of them that went to both.

In the table, NULL stands for The supplied Item contains a null AttributeValue, and ... stands for Start of structure or map found where not expected: invalid type: null, expected.

Request DynamoDB ExtendDB
GetItem "AttributesToGet": [null] ValidationException: Empty attribute name SerializationException: ... a string
Query with KeyConditions, "AttributesToGet": [null] ValidationException: Empty attribute name SerializationException: ... a string
BatchGetItem, "AttributesToGet": [null] in RequestItems ValidationException: Empty attribute name SerializationException: ... a string
GetItem "Key": {"pk": null} ValidationException: NULL: pk is null SerializationException: ... a DynamoDB AttributeValue map with exactly one type descriptor
DeleteItem "Key": {"pk": null} ValidationException: NULL: pk is null the AttributeValue map text of row 4
UpdateItem "Key": {"pk": null} ValidationException: NULL: pk is null the AttributeValue map text of row 4
BatchGetItem "Keys": [{"pk": null}] ValidationException: NULL: pk is null the AttributeValue map text of row 4
BatchWriteItem DeleteRequest "Key": {"pk": null} ValidationException: NULL: pk is null the AttributeValue map text of row 4
Scan, FilterExpression a = :v, "ExpressionAttributeValues": {":v": null} ValidationException: ExpressionAttributeValues contains invalid value: NULL for key :v the AttributeValue map text of row 4
PutItem, ConditionExpression a = :v, ":v": null ValidationException: ExpressionAttributeValues contains invalid value: NULL for key :v the AttributeValue map text of row 4
UpdateItem, UpdateExpression SET a = :v, ":v": null ValidationException: ExpressionAttributeValues contains invalid value: NULL for key :v the AttributeValue map text of row 4
BatchWriteItem PutRequest "Item": {"pk": null} ValidationException: NULL: pk is null the AttributeValue map text of row 4
BatchWriteItem PutRequest "Item": {"pk": {"S": "k1"}, "a": null} ValidationException: NULL: a is null the AttributeValue map text of row 4
TransactWriteItems Put "Item": {"pk": null} ValidationException: NULL: pk is null the AttributeValue map text of row 4
TransactWriteItems Put "Item": {"pk": {"S": "k1"}, "a": null} ValidationException: NULL: a is null the AttributeValue map text of row 4

The code at origin/main:

  • GetItemInput (crates/core/src/types/item.rs, line 190), QueryInput (crates/core/src/types/query.rs, line 96) and KeysAndAttributes (crates/core/src/types/batch.rs, line 33) read AttributesToGet as Option<Vec<String>>, which takes no null element.
  • Keys, ExpressionAttributeValues entries and the items of BatchWriteItem and TransactWriteItems go to AttributeValueVisitor (crates/core/src/types/attribute_value.rs, line 69), which takes a map only.
  • deserialize_error (crates/engine/src/lib.rs) maps each of these serde errors to SerializationException.

Proposed change: refuse a null in these members with DynamoDB's texts above, as ValidationException. The readers that the fix for #1050 adds for the PutItem item and the Scan AttributesToGet can serve them.

Activity

  1. LeeroyHannigan commented on Nov 21, 2026

    @LeeroyHannigan
    CollaboratorAuthor

    GetItem with ProjectionExpression #n and ExpressionAttributeNames {"#n": null} answers ValidationException ExpressionAttributeNames contains invalid value: Empty attribute name for key #n on DynamoDB (us-east-1, 2026-11-21, twice). ExtendDB answers SerializationException Start of structure or map found where not expected: invalid type: null, expected a string. On DynamoDB, SearchVectors answers the same request with SerializationException invalid type: null, expected a string at line 1 column 222, and ExtendDB gives SearchVectors the same type.

  2. LeeroyHannigan commented on Nov 24, 2026

    @LeeroyHannigan
    CollaboratorAuthor

    Three more Query members, measured in us-east-1 on 24 November 2026 at 08:58 UTC, with signed requests that carry the JSON bodies below. The TableName does not exist. Each request went out twice and got the same answer both times. Every body carries KeyConditionExpression: pk = :p and :p set to {"S": "x"}.

    Request DynamoDB ExtendDB at origin/main 44cd436
    "ScanIndexForward": null ResourceNotFoundException: Requested resource not found SerializationException: Start of structure or map found where not expected: invalid type: null, expected a boolean
    "ExpressionAttributeNames": {"#a": null} ValidationException: ExpressionAttributeNames contains invalid value: Empty attribute name for key #a SerializationException: Start of structure or map found where not expected: invalid type: null, expected a string
    "ExpressionAttributeNames": {"#a": null} beside :n set to {"N": "bob"} ValidationException: ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :n the expected a string text of row 2

    DynamoDB reads "ScanIndexForward": null as an absent member, so the request reaches the table lookup, as #1050 shows for "ReturnConsumedCapacity": null. It reads a null name as an empty name, and it reports that name after the Select, ReturnConsumedCapacity and number checks. {"#a": null} beside Select: "NOPE" or ReturnConsumedCapacity: "NOPE" answers that enum's text. Beside {"N": "bob"} it answers the numeric text in the ExpressionAttributeValues contains invalid value: ... for key form, the form DynamoDB uses on its older validation path (#976 shows it beside a Limit above 2147483647). DynamoDB reports an empty name written as "" ahead of those checks instead (measured 19 November 2026, in #544).

    The code at origin/main:

    • QueryInput (crates/core/src/types/query.rs) reads ScanIndexForward as bool with #[serde(default = "default_true")]. serde applies the default to a missing member only, and hands a null to the bool reader.
    • deserialize_expression_names (crates/core/src/serde_helpers.rs) refuses an empty string with the Empty attribute name text and hands a null to the String reader. Its comment says that a non-string matches DynamoDB. For a null it does not.

    #544 changes the request-time checks only. Beside an invalid enum they now answer the enum text for both members, as main and DynamoDB do. Beside {"N": "bob"} they answer the bare numeric text. The handler's deserializer still refuses both nulls as above.

    Proposed change: read "ScanIndexForward": null as an absent member, as #1103 does for ReturnConsumedCapacity. Read a null name as an empty name and refuse it with the Empty attribute name text, after the other request checks. The wrapped numeric text beside a null name belongs to the older validation path and is not part of this proposal.

  3. demohan commented on Nov 25, 2026

    @demohan
    Collaborator

    Two more shapes for this issue, from a Query on a table that exists (KeyConditionExpression: "pk = :p", :p = {"S": "x"}). Each was sent twice to the service in us-east-1 and to a SQLite build of #544's head (31c5f3d):

    Extra members Service ExtendDB
    ExpressionAttributeNames: {"#a": null}, Limit: 0 1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1 1 validation error detected: Value at 'Limit' failed to satisfy constraint: ...
    ExpressionAttributeNames: {"#a": null}, Select: "NOPE", Limit: 0 2 validation errors detected: Value 'NOPE' at 'select' ...; Value '0' at 'limit' ... the Value at 'Limit' text alone

    The service handles a body with a null name as it handles a value it cannot read as one type: it uses the lowercase Value '0' at 'limit' form and reports Select and Limit together. The third shape from the same measurement, a null name beside :n = {"N": "bob"}, is the one this issue already lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions