FP404 · undefined-matrix-key
An expression reads a matrix key that no combination defines (or the job has no matrix).
| Code | Name | Category | Default severity | Reported by |
|---|---|---|---|---|
FP404 | undefined-matrix-key | Matrix | 🔴 error | lint, check, the action, the editor |
What you see
In the dynamic-matrix fixture:
✖ ERROR FP404 undefined-matrix-key
matrix.sute is not defined in any combination of jobs.sharded (keys: suite, shard, experimental)
▶ .github/workflows/matrix.yml:36:24Why it matters
The value is always empty — almost certainly a typo or a key that was renamed in the matrix. A comparison or test on it always gives the same answer, and a condition on it never changes. Only a read with a fallback that is not empty (matrix.key || 'default') is info, since the fallback always applies, unless the key is close to one the matrix defines.
How to fix
Fix the key name, add it to the matrix, or drop the read if the fallback is what you want.
Example
strategy:
matrix:
suite: [unit, integration]
steps:
- run: npm test -- --suite ${{ matrix.sute }} # no combination defines "sute"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[FP404] why):
# flowpact: ignore[FP404] why it is acceptable here
- run: echo "${{ matrix.sute }}"In the config, with an override, which can expire:
overrides:
- rule: FP404
target: ".github/workflows/matrix.yml#jobs.sharded.matrix.sute"
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 == "FP404") | .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:
FP404: off
# or: undefined-matrix-key: errorExplain it in the terminal:
flowpact explain FP404Related
FP402matrix-key-missing-in-combo: An expression reads a matrix key that is only defined in some combinations.- How matrices are expanded