Terraform: Error: Inconsistent dependency lock file — provider x: required by this configuration but no version is selected
The .terraform.lock.hcl file doesn’t match the providers/versions your configuration now requires, or init wasn’t run.
Inconsistent dependency lock filerequired by this configuration but no version is selectedthe cached package does not match any of the checksums recorded in the dependency lock file Meaning
Adding a provider, changing version constraints, or switching platforms (lock file only has hashes for one OS) requires terraform init -upgrade or providers lock for all platforms.
Common causes
- Provider added/changed without terraform init
- Lock file missing hashes for the CI platform (darwin vs linux)
- Version constraint changed
- .terraform directory stale
⚡ Quick fix
- Run terraform init -upgrade and commit the lock file
- Add hashes for all platforms with terraform providers lock
- Delete .terraform/ and init again
Detailed fix by platform
Shell
- hcl
terraform init -upgrade terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 -platform=windows_amd64
How to diagnose
- Lock — Providers listed
- Platforms — Hashes for CI OS?
- Init — Run after change?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026