cicd
configuration
ai_generated
true
Error: environment variable DATABASE_URL is not set
ID: cicd/env-variable-not-set
92%Fix Rate
94%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
A required environment variable is not set in the CI environment. Common causes include missing secrets configuration, incorrect variable scoping (job vs step vs workflow level), or environment-specific variables not configured for the deployment target.
genericWorkarounds
-
92% success Configure the variable as a repository secret and reference it in the workflow
Go to repo Settings > Secrets and variables > Actions > New repository secret. In the workflow, reference it: env: DATABASE_URL: ${{ secrets.DATABASE_URL }}. For environment-specific values, use GitHub Environments. -
90% success Use GitHub Actions environment variables for non-sensitive values
Set variables at the appropriate scope. Workflow level: env: at the top of the YAML. Job level: jobs.<id>.env. Step level: steps[*].env. For dynamic values, use echo 'VAR=value' >> $GITHUB_ENV.
Dead Ends
Common approaches that don't work:
-
Hardcoding the value directly in the workflow YAML
80% fail
Sensitive values (API keys, passwords, tokens) should never be committed to version control. Even for non-sensitive values, hardcoding reduces portability across environments.
-
Setting the variable in one job expecting it to be available in another
85% fail
Each GitHub Actions job runs in a fresh VM. Environment variables set in one job are not available in other jobs unless explicitly passed via outputs or artifacts.
Error Chain
Preceded by:
Frequently confused with: