GitHub Actions "Missing environment 'production'"
A job that names environment: production expects an environment defined in the repository. If it is misspelled or never created, the deploy cannot resolve its protection rules, secrets, or URL.
What this error means
The deploy job fails or the environment-scoped secrets are empty because the named environment does not match any configured environment.
Error: Missing environment 'production'
The environment referenced in the job does not exist in this repository.Common causes
Environment never created
No environment named production exists under Settings > Environments, so the reference has nothing to bind to.
Name mismatch or casing
The job uses a slightly different name (prod, Production) than the configured environment.
How to fix it
Create or correct the environment name
- Create the environment under Settings > Environments with the exact name used in the job.
- Or change the job to reference the existing environment name (names are case-sensitive in matching).
- Add protection rules and environment secrets there if the deploy needs them.
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: ${{ steps.deploy.outputs.page_url }}How to prevent it
- Define every referenced environment in repository settings before merging the workflow.
- Keep environment names consistent across workflows to avoid drift.