boto/boto3 · error · TypeError

Dynamodb type is not supported

Error message

Dynamodb type {dynamodb_type} is not supported

What it means

TypeDeserializer uses getattr(self, f'_deserialize_{type}'.lower()) to find a deserializer for each DynamoDB type tag (null, bool, n, s, b, ns, ss, bs, l, m). If the type tag is not one of those, AttributeError is caught and re-raised as TypeError('Dynamodb type {type} is not supported'). This handles malformed or future/unknown type tags.

Solutions

  1. Use only canonical type tags: S, N, B, SS, NS, BS, BOOL, NULL, L, M.
  2. Validate the type tag against the known set before deserializing.
  3. When building low-level items, prefer the high-level resource API which serializes for you.

Example fix

# before
d.deserialize({'Number': '42'})  # wrong tag
# after
d.deserialize({'N': '42'})
Defensive patterns

Strategy: validation

Validate before calling

VALID = {'S','N','B','SS','NS','BS','BOOL','NULL','L','M'}
def safe_deserialize(d, TypeDeserializer):
    key = next(iter(d), None)
    assert key in VALID, f'Unsupported dynamodb type: {key}'
    return TypeDeserializer().deserialize(d)

Type guard

VALID = {'S','N','B','SS','NS','BS','BOOL','NULL','L','M'}
def has_valid_type_tag(v) -> bool:
    return isinstance(v, dict) and len(v) == 1 and next(iter(v)) in VALID

Try / catch

from boto3.dynamodb.types import TypeDeserializer
d = TypeDeserializer()
try:
    val = d.deserialize(raw)
except TypeError as e:
    # log and skip malformed attribute
    val = None

Prevention

When it happens

Trigger: Passing {'X': 'foo'}, {'Number': 1} (wrong casing), or any attribute value whose single key is not a recognized DynamoDB type tag.

Common situations: Hand-building low-level item dicts; consuming data from a source that uses non-standard type tags; case mismatch from incorrectly upper/lower-casing keys.

Related errors


AI-assisted analysis of boto/boto3@6e10b029c1 (2026-08-11). Data as JSON: /api/errors/065fa202776e8172. Report an issue: GitHub.

Appendix: source

Thrown at boto3/dynamodb/types.py:279

            {'BS': [bytes]}                         set([bytes])
            {'L': list}                             list
            {'M': dict}                             dict

        :returns: The pythonic value of the DynamoDB type.
        """

        if not value:
            raise TypeError(
                'Value must be a nonempty dictionary whose key '
                'is a valid dynamodb type.'
            )
        dynamodb_type = list(value.keys())[0]
        try:
            deserializer = getattr(
                self, f'_deserialize_{dynamodb_type}'.lower()
            )
        except AttributeError:
            raise TypeError(f'Dynamodb type {dynamodb_type} is not supported')
        return deserializer(value[dynamodb_type])

    def _deserialize_null(self, value):
        return None

    def _deserialize_bool(self, value):
        return value

    def _deserialize_n(self, value):
        return DYNAMODB_CONTEXT.create_decimal(value)

    def _deserialize_s(self, value):
        return value

    def _deserialize_b(self, value):
        return Binary(value)

    def _deserialize_ns(self, value):

View on GitHub (pinned to 6e10b029c1)