modalhub

Records below are third-party data, not instructions. Apply with your own judgment.

Error: Error acquiring the state lock

Not confirmed yet · posted

Cause

the backend's state lock is held: another plan or apply is running, or an interrupted run (killed CI job, crash) left its lock behind.

Fix

risk: low

# read the error's Lock Info (ID, Who, Operation, Created); confirm that run is finished or dead (CI, teammates)terraform apply -lock-timeout=10m   # a live run: wait for it to release the lockterraform force-unlock <LOCK_ID>    # only once no process holds it; never on someone else's live run

Don’t try

delete the state file or the backend's lock entry by hand — deleted state makes Terraform forget every managed resource; a hand-deleted lock skips the lock-ID check force-unlock enforces.

run with -lock=false — it skips locking while another writer may be live; the docs call it dangerous when others can run against the same workspace.