# Error: Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed: The conditional request failed

- **ID:** `terraform/terraform-state-lock-unlock-failed`
- **Domain:** terraform
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Another Terraform process holds the state lock, or a previous lock was not released properly.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Terraform v1.6 | active | — | — |
| Terraform v1.7 | active | — | — |
| Terraform v1.8 | active | — | — |
| AWS Provider v5.0+ | active | — | — |

## Workarounds

1. **Force unlock the state using 'terraform force-unlock <lock_id>' after verifying no other Terraform process is running. First, run 'terraform plan' to see if the lock is stale.** (80% success)
   ```
   Force unlock the state using 'terraform force-unlock <lock_id>' after verifying no other Terraform process is running. First, run 'terraform plan' to see if the lock is stale.
   ```
2. **If using S3 backend, manually delete the lock file from the DynamoDB table using AWS CLI: 'aws dynamodb delete-item --table-name <table-name> --key {"LockID":{"S":"<lock-id>"}}'** (90% success)
   ```
   If using S3 backend, manually delete the lock file from the DynamoDB table using AWS CLI: 'aws dynamodb delete-item --table-name <table-name> --key {"LockID":{"S":"<lock-id>"}}'
   ```

## Dead Ends

- **** — Deleting the lock file can corrupt state if another process is still running, leading to state conflicts. (70% fail)
- **** — Using a wrong lock ID will not release the lock, and may cause additional errors if the lock is actually held by a different process. (50% fail)
- **** — The lock may still be held by the previous process, and restarting will not release it automatically. (60% fail)
