GitHub Actions "Job depends on unknown job"
A job under needs: references an id that is not declared. The dependency graph cannot be resolved.
What this error means
The workflow is rejected with "Job <X> depends on unknown job <Y>", naming both jobs.
github-actions
The workflow is not valid. .github/workflows/ci.yml (Line: 18): Job 'publish' depends on unknown job 'package'Common causes
Renamed job not updated everywhere
Renaming a job id without updating its dependents leaves a dangling needs reference.
Case mismatch in the id
Job ids are case-sensitive; Package and package are different.
How to fix it
Update needs to a defined job id
- Search the file for the old id and update every needs reference.
- Confirm exact case and spelling.
.github/workflows/ci.yml
jobs:
package: { runs-on: ubuntu-latest, steps: [{ run: ./pkg }] }
publish: { needs: package, runs-on: ubuntu-latest, steps: [{ run: ./pub }] }How to prevent it
- Rename job ids with a find-and-replace across the file.
- Run actionlint to catch dangling needs.
Related guides
GitHub Actions "needs job X but it is not defined"Fix the GitHub Actions error where a job needs another job that is not defined, usually a typo in the job id…
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…