GitHub Actions "error parsing called workflow ... secret X is not defined" in CI
A reusable workflow must declare each secret it accepts under on.workflow_call.secrets (or use secrets: inherit). Passing a secret the callee never declared fails the call while parsing the called workflow.
What this error means
The caller fails with "error parsing called workflow" and "secret 'X' is not defined" for a key passed under the job's secrets:.
GitHub Actions
error parsing called workflow
".github/workflows/deploy.yml":
secret 'NPM_TOKEN' is not defined in the referenced workflowCommon causes
The callee never declared the secret
The reusable workflow has no matching entry under on.workflow_call.secrets, so the named secret is unknown.
A name mismatch between caller and callee
The caller passes NPM_TOKEN but the callee declares a differently named secret.
How to fix it
Declare the secret in the called workflow
- Add the secret under
on.workflow_call.secretsin the callee. - Pass it from the caller with a matching name.
- Re-run.
.github/workflows/deploy.yml
# callee
on:
workflow_call:
secrets:
NPM_TOKEN:
required: trueForward all secrets with inherit
When the callee uses declared secrets, the caller can pass secrets: inherit to forward the caller secrets without listing each one.
.github/workflows/caller.yml
jobs:
call:
uses: ./.github/workflows/deploy.yml
secrets: inheritHow to prevent it
- Declare every secret a reusable workflow consumes.
- Keep secret names identical across caller and callee.
- Use
secrets: inheritonly when the callee declares what it reads.
Related guides
GitHub Actions reusable workflow "Required input is not provided" in CIFix GitHub Actions "the workflow ... requires input 'X' but ... not provided" in CI - a reusable workflow dec…
GitHub Actions reusable workflow "Invalid input, X is not defined" in CIFix GitHub Actions "invalid input, X is not defined in the referenced workflow" in CI - the caller passed an…
GitHub Actions reusable workflow nesting limit exceeded in CIFix GitHub Actions reusable-workflow nesting errors in CI - a chain of workflow_call workflows exceeds the ma…