Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform: Failed to unlock state: failed to retrieve lock info: unexpected end of JSON input

  • Terraform v0.13.5
  • provider aws v3.7.0
  • Backend: AWS S3+DynamoDB

terraform plan was aborted, and now it cannot acquire the state lock. I'm trying to release it manually but get error:

terraform force-unlock -force xxx-xxx-xx-dddd

Failed to unlock state: failed to retrieve lock info:
unexpected end of JSON input

The state file looks complete and passes json syntax validation successfully.

How to fix that?

like image 867
Putnik Avatar asked Jan 21 '26 01:01

Putnik


2 Answers

Solution: double-check you're in correct terraform workspace.

like image 107
Putnik Avatar answered Jan 23 '26 19:01

Putnik


I had the same issue. In my case, there were more than 1 .tfstate files in the working directory. This was causing the problem.

1- Ensure you have only 1 .tfstate file in the working directory

2- Ensure .tfstate file is valid.

like image 44
hbceylan Avatar answered Jan 23 '26 19:01

hbceylan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!