Skip to Content
flowpact

FP505 · context-not-available

An expression uses a context or function that GitHub does not allow in that field (e.g. `env` in a reusable workflow call’s `with:`).

CodeNameCategoryDefault severityReported by
FP505context-not-availableEnv & expressions🔴 errorlint, check, the action, the editor

Why it matters

GitHub only makes some contexts available per field. env is not passed to reusable workflows and cannot be used in jobs.<id>.with or jobs.<id>.if; secrets cannot be used in if:. GitHub rejects the whole workflow when it is triggered — often only on the branch or event that reaches it. Reported by GitHub’s own parser.

How to fix

Use a context that is available there: pass values through inputs/vars, compute them in an earlier job and read needs.<job>.outputs, or move the check into a step (if: env.X == ... works in steps).

Example

env:
  TARGET: prod
jobs:
  deploy:
    uses: ./.github/workflows/deploy.yml
    with:
      target: ${{ env.TARGET }}   # env is not available here

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[FP505] why):

.github/workflows/ci.yml
# flowpact: ignore[FP505] why it is acceptable here
<the line of the finding>

In the config, with an override, which can expire:

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP505
    target: <the finding's symbol>
    reason: Why it is acceptable here, at least 10 characters.
    expires: YYYY-MM-DD   # optional

target is the symbol the finding is about; to list them:

flowpact lint --format json | jq -r '.findings[] | select(.code == "FP505") | .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:

.github/flowpact/flowpact.config.yml
rules:
  FP505: off
  # or: context-not-available: error

Explain it in the terminal:

flowpact explain FP505
  • FP502 expression-parse-error: A ${{ }} expression (or an if: condition) cannot be parsed.

On this page