## 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

```text
Error: Failed to load state: state snapshot was created by Terraform v1.5.0, which is newer than current v1.4.0
```

## Steps to fix

1. Find which version wrote the state: ask the teammate/CI that last applied, or check the `terraform_version` field in a state backup.
   - Expected: you know the minimum version you need.
2. Install that version or newer:
   ```bash
   tfenv install 1.5.0 && tfenv use 1.5.0
   terraform version
   ```
   - Expected: `terraform version` reports >= the state version.
3. Re-run `terraform init` (a reconfigure is not needed; the backend config is unchanged), then `plan`.
   - Expected: state loads and plan proceeds.
4. Pin the version everywhere: `.terraform-version` file, CI image tag, and `required_version` in 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 state` is 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 `latest` cause 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.