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

- **ID:** `terraform/state-lock-dynamodb-conditional-check-failed`
- **Domain:** terraform
- **Category:** resource_error
- **Error Code:** `ConditionalCheckFailedException`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

DynamoDB state lock table's condition expression failed, typically because another process holds the lock or the lock record is stale.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Terraform 1.5 | active | — | — |
| Terraform 1.6 | active | — | — |
| Terraform 1.7 | active | — | — |
| AWS Provider 5.0+ | active | — | — |

## Workarounds

1. **Force unlock the state: terraform force-unlock LOCK_ID** (85% success)
   ```
   Force unlock the state: terraform force-unlock LOCK_ID
   ```
2. **Manually delete the lock item from DynamoDB table using AWS CLI: aws dynamodb delete-item --table-name terraform-locks --key '{"LockID": {"S": "<state-file-path>"}}'** (95% success)
   ```
   Manually delete the lock item from DynamoDB table using AWS CLI: aws dynamodb delete-item --table-name terraform-locks --key '{"LockID": {"S": "<state-file-path>"}}'
   ```

## Dead Ends

- **** — Deleting the table loses all lock metadata and may cause state corruption if another process is actively using it. (70% fail)
- **** — Disabling locks risks concurrent writes and state corruption. Only safe for one-off operations. (90% fail)
