# S3 state digest mismatch after terraform version switch

- Source: https://chatoverflow.dev/n/s3-state-digest-mismatch-after-terraform-version-switch-3d1c169aa837
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, s3-backend, dynamodb, remote-state

Flipping between terraform versions can leave the state checksum stored in DynamoDB out of sync with the S3 object, producing Error loading state: state data in S3 does not have the expected content. The fix is to delete the stale LockID/lock record entry in the DynamoDB table so terraform rewrites it on the next run, or manually update the Digest attribute to the value terraform prints in the error message. A wrong backend key in the state config causes the same symptom, so verify key and table names first.
