FP301 · undefined-output-ref
An expression reads an output (`needs.*`, `jobs.*`, `steps.*`) that is never defined.
| Code | Name | Category | Default severity | Reported by |
|---|---|---|---|---|
FP301 | undefined-output-ref | Outputs | 🔴 error | lint, check, the action, the editor |
What you see
In the composite-actions fixture:
✖ ERROR FP301 undefined-output-ref
Step "tools" runs after this step, so its outputs are not available yet
▶ .github/workflows/build.yml:9:30Why it matters
Undefined outputs evaluate to an empty string. Downstream jobs then run with missing versions, tags or flags.
How to fix
Fix the output name, declare the output on the job/workflow/action, or reference the right job or step. In a composite action, a step writing to $GITHUB_OUTPUT sets its own output, not the action's: give the step an id and map the output under the action's outputs: (value: ${{ steps.<id>.outputs.<name> }}).
Example
jobs:
build:
outputs:
version: ${{ steps.meta.outputs.version }}
deploy:
needs: build
run: deploy ${{ needs.build.outputs.vesion }}Accept one finding
When a finding is intended, accept it with a reason rather than turning the rule off. It is listed apart from the other findings, and does not fail the build.
On its line, with an ignore comment alone on the line above it (the
editor's quick fix adds it there) or at the end of the line, after any other comment such as a version
(# v4.3.0 # flowpact: ignore[FP301] why):
# flowpact: ignore[FP301] why it is acceptable here
- run: echo "tools ${{ steps.tools.outputs.version }}"In the config, with an override, which can expire:
overrides:
- rule: FP301
target: ".github/workflows/build.yml#jobs.build.steps.tools.outputs.version"
reason: Why it is acceptable here, at least 10 characters.
expires: YYYY-MM-DD # optionaltarget is the symbol the finding is about; to list them:
flowpact lint --format json | jq -r '.findings[] | select(.code == "FP301") | .symbol'* matches within a path segment and ** across segments, so one entry accepts every finding whose symbol matches:
target: '**#inputs.app-id' is that input in every workflow and action.
Change the severity
Change the severity (or turn the rule off) in .github/flowpact/flowpact.config.yml, by code or by name:
rules:
FP301: off
# or: undefined-output-ref: errorExplain it in the terminal:
flowpact explain FP301Related
FP302output-ref-without-needs:needs.<job>is read where theneedscontext does not contain<job>.FP304step-output-never-written: An output is read from a step whose inline script (run:oractions/github-script) writes other outputs, but never this one.FP303unused-output: A job output, or an output of an internal reusable workflow or action, is declared but nothing reads it.- Remote interfaces