GitHub Actions "needs job X but it is not defined"
A job lists a dependency under needs: that does not match any job id in the workflow. Actions cannot build the graph.
What this error means
The workflow is rejected with a message that a job needs another job that is not defined, naming the missing id.
github-actions
The workflow is not valid. .github/workflows/ci.yml (Line: 20): Job 'deploy' depends on unknown job 'biuld'Common causes
Typo in the needs reference
needs: biuld does not match the job id build.
Referencing a job in another workflow
needs: only works between jobs in the same workflow file.
How to fix it
Match needs to an existing job id
- Correct the spelling to the exact job id.
- Only reference jobs defined in the same workflow.
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps: [{ run: make }]
deploy:
needs: build
runs-on: ubuntu-latest
steps: [{ run: ./deploy }]How to prevent it
- Keep job ids short and consistent to reduce typos.
- Run actionlint, which validates the needs graph.
Related guides
GitHub Actions "needs that creates a cycle"Fix the GitHub Actions error "You cannot use needs that creates a cycle" caused by two or more jobs depending…
GitHub Actions "The identifier is invalid" for a job idFix the GitHub Actions "The identifier is invalid" error caused by a job id that starts with a number or cont…
GitHub Actions two jobs with the same idFix the GitHub Actions error caused by two jobs sharing the same id, which YAML treats as a duplicate mapping…