GitHub Actions needs context outputs are undefined
A job's step output is not automatically visible to dependent jobs. The job must declare an outputs map that lifts the step output, and the dependent job must list it under needs. Miss either and needs.<job>.outputs.<name> is empty.
What this error means
A dependent job reads needs.<job>.outputs.<name> and gets an empty string, so a later step or condition misbehaves.
github-actions
# build.outputs.version was never declared
echo "deploying ${{ needs.build.outputs.version }}"
-> deploying (empty)Common causes
Upstream job did not declare outputs
The producing job set a step output but never mapped it under jobs.<job>.outputs, so nothing crosses the job boundary.
Dependent job missing the needs edge
Without listing the upstream job in needs, its outputs context is unavailable.
How to fix it
Declare job outputs and the needs edge
- In the producing job, map the step output to a job-level outputs entry.
- In the consuming job, add the producing job to needs.
- Reference needs.<job>.outputs.<name>; re-run.
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- id: meta
run: echo "version=1.2.3" >> "${GITHUB_OUTPUT}"
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- run: echo "deploy ${{ needs.build.outputs.version }}"How to prevent it
- Lift step outputs to job-level outputs for anything dependent jobs need.
- List every producing job in the consumer's needs.
Related guides
GitHub Actions needs.<job>.outputs undefined when upstream skippedFix GitHub Actions where needs.<job>.outputs.* is empty - a skipped or failed upstream job produces no output…
GitHub Actions reusable workflow "with:" input type mismatchFix the GitHub Actions error where a reusable workflow rejects a "with:" input because the value type does no…
GitHub Actions continue-on-error did not propagate the step outcomeFix the GitHub Actions confusion where continue-on-error hides a failure so downstream conditions on conclusi…