terraform
state
ai_generated
true
Error: Error acquiring the state lock
ID: terraform/state-lock-error
94%Fix Rate
96%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 115 | active | — | — | — |
| 1 | active | — | — | — |
Root Cause
Another Terraform process holds the state lock, or a previous run crashed without releasing it.
genericWorkarounds
-
85% success Wait for the other process to finish, then retry
Check who holds the lock — the error message includes the lock ID and creator
-
93% success Use terraform force-unlock <LOCK_ID> only after confirming no other process is running
Verify no other Terraform processes: ps aux | grep terraform
Sources: https://developer.hashicorp.com/terraform/cli/commands/force-unlock
Dead Ends
Common approaches that don't work:
-
Running terraform force-unlock immediately
70% fail
May corrupt state if another process is genuinely running
-
Deleting the lock file from the backend manually
80% fail
Backend-specific and risky; may lose state data
Error Chain
Frequently confused with: