# Error: Error acquiring the state lock: LockInfoError: The conditional request failed. The lock has expired or is held by another process. Lock ID: abc123

- **ID:** `cicd/terraform-state-lock-expired`
- **Domain:** cicd
- **Category:** resource_error
- **Error Code:** `STATE_LOCK_EXPIRED`
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

Terraform state lock in a remote backend (e.g., AWS DynamoDB) has expired or is stuck due to a previous crashed operation, preventing new operations from acquiring the lock.

## 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 using terraform force-unlock <LOCK_ID> after verifying no other process is running. First, check the lock info with terraform plan or by querying the DynamoDB table.** (90% success)
   ```
   Force unlock the state using terraform force-unlock <LOCK_ID> after verifying no other process is running. First, check the lock info with terraform plan or by querying the DynamoDB table.
   ```
2. **Manually delete the lock item from the DynamoDB table using AWS CLI if force-unlock fails due to permissions or network issues.** (85% success)
   ```
   Manually delete the lock item from the DynamoDB table using AWS CLI if force-unlock fails due to permissions or network issues.
   ```
3. **Increase the lock timeout in the backend configuration by setting the 'lock_timeout' parameter (e.g., 60s) to allow longer operations to complete before the lock expires.** (80% success)
   ```
   Increase the lock timeout in the backend configuration by setting the 'lock_timeout' parameter (e.g., 60s) to allow longer operations to complete before the lock expires.
   ```

## Dead Ends

- **** — terraform init only initializes the backend configuration; it does not manage locks. (90% fail)
- **** — This is an extreme measure that should only be used if the state is backed up; it is not a safe fix for lock issues. (95% fail)
- **** — The lock is checked at the beginning of any state-modifying operation, regardless of approval flags. (85% fail)
