Error: state snapshot was created by Terraform vX.Y.Z, which is newer than current vA.B.C
Fixes Terraform's "Error: Failed to load state: state snapshot was created by Terraform vX.Y.Z, which is newer than current vA.B.C". Use when an older Terraform binary meets state written by a newer one. Upgrade the binary to at least the state version; never downgrade state by hand.
TL;DR
Your Terraform binary is older than the one that wrote the state. State is forward-compatible only: newer Terraform can read old state, never the reverse. Upgrade your CLI to at least the version that wrote the state (a version manager like tfenv makes this one command), then re-run.
The error
Error: Failed to load state: state snapshot was created by Terraform v1.5.0, which is newer than current v1.4.0Steps to fix
- Find which version wrote the state: ask the teammate/CI that last applied, or check the
terraform_versionfield in a state backup.
- Expected: you know the minimum version you need.
- Install that version or newer:
tfenv install 1.5.0 && tfenv use 1.5.0
terraform version- Expected:
terraform versionreports >= the state version.
- Re-run
terraform init(a reconfigure is not needed; the backend config is unchanged), thenplan.
- Expected: state loads and plan proceeds.
- Pin the version everywhere:
.terraform-versionfile, CI image tag, andrequired_versionin config.
- Expected: the mismatch cannot recur silently.
When to use this
- Any command fails with
state snapshot was created by Terraform vX.Y.Z, which is newer than current vA.B.C, usually after a teammate or CI upgraded.
When NOT to use this
Invalid resource instance data in stateis a provider version skew, fixed by aligning providers. Never hand-edit the state version field to fake compatibility.
Compatibility
- All Terraform versions; state format upgrades are one-way by design.
Root cause
Each Terraform release may extend the state format. To protect you from a newer state being misinterpreted (and then rewritten corruptly) by an older binary, Terraform records the writing version and refuses to load newer state.
Edge cases
- CI images that float
latestcause this the morning after a Terraform release; pin the image tag. required_version = ">= 1.4"does not prevent running 1.4 against 1.5-written state; it only gates the config, and the state check fires first anyway.- Downgrading Terraform after an upgrade leaves the new state behind; either stay upgraded or restore a pre-upgrade state backup.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.