Skip to content
Latchkey

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 workflow

Common 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

  1. Add the secret under on.workflow_call.secrets in the callee.
  2. Pass it from the caller with a matching name.
  3. Re-run.
.github/workflows/deploy.yml
# callee
on:
  workflow_call:
    secrets:
      NPM_TOKEN:
        required: true

Forward 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: inherit

How to prevent it

  • Declare every secret a reusable workflow consumes.
  • Keep secret names identical across caller and callee.
  • Use secrets: inherit only when the callee declares what it reads.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →