Skip to content

Query beside a value the service cannot read leaves an invalid ConditionalOperator out of the combined message #978

Open

Description

@LeeroyHannigan

When ExpressionAttributeValues holds a value the service cannot read as one type, the service reports several faults in one message. The message can name an invalid Select, an invalid ReturnConsumedCapacity, an invalid ConditionalOperator and a Limit below 1, in that order. The service reports this message ahead of the parameter mix. ExtendDB leaves ConditionalOperator out of that message.

I measured the service in us-east-1 on 2026-11-11, each request twice, with KeyConditionExpression pk = :p and :p = {"S": "x"}. The ExtendDB column is a local SQLite server built from the #544 branch.

Request Service ExtendDB
:z = {"X": "1"}, Limit 0, ConditionalOperator "XOR" ValidationException: 2 validation errors detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]; Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1 ValidationException: 1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1
:z = {"X": "1"}, ConditionalOperator "XOR" ValidationException: 1 validation error detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND] ValidationException: Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {ConditionalOperator} Expression parameters: {KeyConditionExpression}
:z = {"X": "1"}, Limit 0, Select "bad", ReturnConsumedCapacity "bad", ConditionalOperator "XOR" ValidationException: 4 validation errors detected: Value 'bad' at 'select' ...; Value 'bad' at 'returnConsumedCapacity' ...; Value 'XOR' at 'conditionalOperator' ...; Value '0' at 'limit' ... ValidationException: 3 validation errors detected: Value 'bad' at 'select' ...; Value 'bad' at 'returnConsumedCapacity' ...; Value '0' at 'limit' ...
ConditionalOperator "XOR", no :z ValidationException: Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {ConditionalOperator} Expression parameters: {KeyConditionExpression} the same

The last row shows that for a body the service can read, the parameter mix comes ahead of the ConditionalOperator value. unreadable_value_checks in crates/engine/src/query_key_values/unreadable.rs builds the combined message from Select, ReturnConsumedCapacity and Limit only.

Activity

  1. LeeroyHannigan commented on Nov 25, 2026

    @LeeroyHannigan
    CollaboratorAuthor

    More shapes of the combined form on Query and Scan, measured in us-east-1 on 24 Nov 2026 on a table that does not exist, each request twice with identical answers. Each request has two legacy filter conditions, a and b, and "ConditionalOperator": "XOR" written last.

    Request Service
    Query, condition a is EQ with ["x"] Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [AND, OR]
    Query, condition a holds an empty AttributeValue ([{}]) 1 validation error detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]
    Query, the ComparisonOperator of a is null 2 validation errors detected: Value null at 'queryFilter.a.member.comparisonOperator' failed to satisfy constraint: Member must not be null; Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]
    Query, condition a holds {"S": 1} SerializationException NUMBER_VALUE cannot be converted to String
    Scan, condition a is EQ with ["x"] the first row's text
    Scan, condition a holds an empty AttributeValue the second row's text
    Scan, condition a holds {"S": 1} the fourth row's answer

    The clause comes alone, with the set as [AND, OR], when both conditions are a valid EQ, and also ahead of the operand count of a BETWEEN with one value (#1100's rows of 13 and 14 November). Beside an empty AttributeValue or a null ComparisonOperator in the filter, the service sends the counted form with [OR, AND]. A value of the wrong JSON type answers ahead of both. hitesh96db's review comment on #1100 lists more shapes that get the counted form, such as {"X": "1"} or {} in ExpressionAttributeValues or ExclusiveStartKey, and Limit 0 beside a faulty filter.

    #1100 matches the first row. On the SQLite and PostgreSQL builds, which read members in name order, it sends the clause alone for the second and third rows as well, because serde stops at the first error. For the fourth row it sends the ConditionalOperator refusal. The MongoDB build reads members in the order written (#723), so its answers to those rows differ again.

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