Bitbucket Deployment Environment Locked (deployment in progress)
By Daniel Zoghalchali·Latchkey
Bitbucket serializes deployments per environment. A deploy is locked out while another deployment to the same environment is in progress - a concurrency guard, not a failure, that clears once the running deploy finishes.
What this error means
A deployment step waits or is blocked noting the environment is locked because a deployment is in progress. It proceeds once the in-flight deploy completes, or you can cancel/queue it.
bitbucket-pipelines
Deployment to "staging" is locked:another deployment to thisenvironment is currently in progress.
Common causes
Concurrent deploy to the same environment
Two pipelines tried to deploy to the same environment at once. Bitbucket locks the environment so deployments do not overlap.
A previous deploy still running or stuck
An in-flight (or hung) deployment keeps the lock until it finishes or is stopped, blocking the next one.
How to fix it
Let the in-flight deploy finish, then retry
Wait for the current deployment to complete; the lock releases automatically.
If a deploy is stuck, stop it from the Pipelines UI to free the environment.
Re-run the blocked deployment once the lock clears.
Serialize deploys deliberately
Avoid launching concurrent deploys to the same environment.
How to prevent it
Avoid triggering concurrent deploys to the same environment.
Watch for stuck deployments holding the lock.
Use deployment ordering so deploys queue instead of collide.
Frequently asked questions
What causes ""environment locked""?
Two pipelines tried to deploy to the same environment at once. Bitbucket locks the environment so deployments do not overlap.
How do I fix "environment locked"?
Let the in-flight deploy finish, then retry
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.