{"id":"065fa202776e8172","repo":"boto/boto3","slug":"dynamodb-type-dynamodb-type-is-not-supported","errorCode":null,"errorMessage":"Dynamodb type {dynamodb_type} is not supported","messagePattern":"Dynamodb type (.+?) is not supported","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"boto3/dynamodb/types.py","lineNumber":279,"sourceCode":"            {'BS': [bytes]}                         set([bytes])\n            {'L': list}                             list\n            {'M': dict}                             dict\n\n        :returns: The pythonic value of the DynamoDB type.\n        \"\"\"\n\n        if not value:\n            raise TypeError(\n                'Value must be a nonempty dictionary whose key '\n                'is a valid dynamodb type.'\n            )\n        dynamodb_type = list(value.keys())[0]\n        try:\n            deserializer = getattr(\n                self, f'_deserialize_{dynamodb_type}'.lower()\n            )\n        except AttributeError:\n            raise TypeError(f'Dynamodb type {dynamodb_type} is not supported')\n        return deserializer(value[dynamodb_type])\n\n    def _deserialize_null(self, value):\n        return None\n\n    def _deserialize_bool(self, value):\n        return value\n\n    def _deserialize_n(self, value):\n        return DYNAMODB_CONTEXT.create_decimal(value)\n\n    def _deserialize_s(self, value):\n        return value\n\n    def _deserialize_b(self, value):\n        return Binary(value)\n\n    def _deserialize_ns(self, value):","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/boto/boto3/blob/c7b4afac237b976d48395d7523eaf7cec3a450b3/boto3/dynamodb/types.py#L261-L297","documentation":"Raised by TypeDeserializer.deserialize when the input dict's key does not correspond to a valid DynamoDB type. The deserializer looks up a method named _deserialize_<key>; if getattr fails (AttributeError), it converts the failure into a TypeError naming the unsupported type. Valid keys are NULL, BOOL, N, S, B, NS, SS, BS, L, M (case-sensitive as defined by the module constants).","triggerScenarios":"TypeDeserializer().deserialize({'XX': 'val'}) — 'XX' is not a DynamoDB type. Also {'n': '1'} (lowercase), {'Number': '1'}, or any misspelled/wrong-case key. This can occur when manually constructing type-tagged dicts or receiving data from a non-DynamoDB source.","commonSituations":"Hand-building DynamoDB-format dicts with wrong key casing; consuming a REST API that uses different type tags; version mismatch where a custom serializer emits non-standard keys.","solutions":["Use only the canonical uppercase keys: S, N, B, SS, NS, BS, BOOL, NULL, L, M.","If consuming external data, map/normalize keys to DynamoDB type tags before deserializing.","Use TypeSerializer to produce values so keys are always correct."],"exampleFix":"# before\nfrom boto3.dynamodb.types import TypeDeserializer\nTypeDeserializer().deserialize({'n': '42'})  # lowercase key\n\n# after\nTypeDeserializer().deserialize({'N': '42'})  # correct uppercase key","handlingStrategy":"validation","validationCode":"from boto3.dynamodb.types import (\n    STRING, NUMBER, BINARY, STRING_SET, NUMBER_SET, BINARY_SET,\n    NULL, BOOLEAN, MAP, LIST,\n)\n\nVALID_TYPES = {STRING, NUMBER, BINARY, STRING_SET, NUMBER_SET, BINARY_SET, NULL, BOOLEAN, MAP, LIST}\n\ndef validate_dynamodb_value(v):\n    if not v or not isinstance(v, dict) or len(v) != 1:\n        raise ValueError(f'Expected single-key DynamoDB dict, got {v!r}')\n    key = next(iter(v))\n    if key not in VALID_TYPES:\n        raise ValueError(f'Invalid DynamoDB type key: {key!r}. Valid: {VALID_TYPES}')\n    return v","typeGuard":"def is_valid_dynamodb_typed_dict(v) -> bool:\n    valid = {'S','N','B','SS','NS','BS','BOOL','NULL','L','M'}\n    return isinstance(v, dict) and len(v) == 1 and next(iter(v)) in valid","tryCatchPattern":null,"preventionTips":["Prefer TypeSerializer over hand-building typed dicts.","Validate the single key against the canonical uppercase set before deserialize.","Document the exact type tags when interfacing with external producers."],"tags":["dynamodb","types","deserialization","invalid-key"],"analyzedSha":"c7b4afac237b976d48395d7523eaf7cec3a450b3","analyzedAt":"2026-08-04T20:35:51.598Z","schemaVersion":2}