dynobase-icon
Dynobase

Error: dynamodb: one or more parameter values were invalid: type mismatch for index key

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

Type mismatch for index key means a write supplied an attribute whose type disagrees with a secondary index key definition. The service validates index keys even when you write directly to the base table.

  1. Inspect the index name and attribute in the error, then compare them with DescribeTable output.
  2. Use the declared String, Number or Binary type. Binary is not a Map; objects cannot be index keys.
  3. With the document client, pass native values. Passing { S: "value" } to it produces a Map and can trigger this error.
  4. For a sparse GSI, omit an optional index key when the item should be excluded. NULL and empty key strings are not substitutes for omission.

For a String email index key, use email: "reader@example.com" with DynamoDBDocumentClient or email: { S: "reader@example.com" } with the low-level client. Ordinary non-key attributes do not need AttributeDefinitions. Correct invalid historical values if index backfill reports key violations.

See GSI behavior and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.