Bitbucket Deployment Environment Not Found
A step declared deployment: <name>, but no environment with that name exists in the repository’s deployment settings - so Bitbucket cannot map the step to an environment.
What this error means
The pipeline fails configuration or the deployment step errors that the named environment is not found or not configured. Deployment tracking and environment variables for that env never apply.
Configuration error: deployment environment "staging" is not
configured for this repository.Common causes
The environment name does not match settings
A deployment: staging step requires an environment named exactly staging in Repository settings → Deployments. A typo or a never-created environment fails to resolve.
Using a non-standard environment tier name
Bitbucket environments belong to tiers (test/staging/production). A custom name must still be created as an environment; the keyword alone does not define it.
How to fix it
Create the environment in settings
- Open Repository settings → Deployments.
- Add an environment whose name matches the
deployment:value in your YAML. - Add any environment-scoped variables there (e.g. deploy keys).
Reference the environment by its exact name
- step:
name: Deploy to staging
deployment: staging
script: [ ./deploy.sh staging ]How to prevent it
- Create deployment environments before referencing them in YAML.
- Keep
deployment:names identical to the configured environment names. - Scope deployment variables to the environment, not globally.