Sub topic 12
Troubleshooting common problems
This chapter assumes you can read a workflow file (events, jobs, steps), know the uses and with keywords, and have seen how actions are pinned to tags or commit SHAs. Most action problems fall into a few groups: the action cannot be resolved, an input is wrong, an output is empty, or a policy or permission blocks the run. Start with the first error line in the log. It usually names the group.
Read the log first
Each step has its own section in the run log. A step that uses an action begins with a "Set up job" phase that lists every action the job downloads. If an action fails to resolve, the job fails there and no step runs. If an action runs and then fails, expand that step and read the lines just above the error.
You can turn on more detail by re-running the job with "Enable debug logging" selected. This sets ACTIONS_STEP_DEBUG for the run.
Action cannot be resolved
Typical messages are Unable to resolve action, Can't find 'action.yml', or repository not found. Check these causes in order.
| Symptom | Likely cause | Fix |
|---|---|---|
| `Unable to resolve action ... unable to find version` | The tag, branch, or SHA after `@` does not exist | Check the repository's releases and tags, then correct the ref |
| `repository not found` | Typo in `owner/repo`, or the repository is private | Fix the spelling, or allow access for private actions |
| `Can't find 'action.yml'` | The action lives in a subdirectory | Add the path, as in `owner/repo/subdir@ref` |
| `is not allowed to be used` | An organization or repository policy blocks it | Ask an admin to allow the action, or choose an allowed one |
Two details cause many of these failures. A short SHA does not work, so you must use the full 40-character commit SHA. A major tag such as v4 only works if the maintainer publishes it, and some projects publish only full versions such as v4.1.2.
Inputs are ignored or rejected
An action reads only the inputs it declares. If you misspell an input name under with, the run usually shows a warning such as Unexpected input(s) 'node_version', and the action uses its default. The input names are case-sensitive and may use hyphens, so check the action's README or action.yml.
steps:
- uses: actions/setup-node@v4
with:
node-version: 20 # correct name; "node_version" would be ignoredValues in with are strings. A value like 20 works, but node-version: 20.10 is read by YAML as the number 20.1. Quote versions that end in zero:
steps:
- uses: actions/setup-node@v4
with:
node-version: "20.10"Outputs are empty
A later step reads an output through the steps context, so the producing step needs an id. Without it, the expression evaluates to an empty string and no error appears. The output name must also match exactly.
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- if: steps.npm-cache.outputs.cache-hit != 'true'
run: echo "Cache miss, dependencies will be downloaded"Outputs are strings. Compare against 'true' in quotes, as above. Also remember that an output exists only after its step finishes, so you cannot read it earlier in the same job order.
Permission and secret errors
An error such as Resource not accessible by integration means the GITHUB_TOKEN lacks a permission the action needs. Read the action's documentation, then add only that permission to the job:
permissions:
contents: read
pull-requests: writeSecrets are not passed to workflows triggered by pull requests from forks, so an action that needs one may fail with an empty value. An action also does not see a secret unless you pass it explicitly, for example token: ${{ secrets.MY_TOKEN }} under with.
Version changes break a working workflow
If a workflow that passed yesterday fails today with no change in your repository, a moving ref is the likely cause. Tags and branches can point to new code. Compare the action's recent releases. To confirm, pin the previous version or its commit SHA and re-run. Pinning to a full SHA, with Dependabot proposing updates, makes these changes visible as pull requests.
A diagnostic path
Exercise
A workflow uses actions/cache@v4 with id: npm-cache. The step if: steps.npm_cache.outputs.cache-hit != 'true' always runs, even after a cache hit. Why, and how do you fix it?
Show answer
The expression uses npm_cache, but the step id is npm-cache. The steps context finds no such step, so the output evaluates to an empty string, which is never equal to 'true'. No error is raised. Fix it by using the exact id: steps.npm-cache.outputs.cache-hit.
Exercise
The log shows Unable to resolve action actions/checkout@abc1234, unable to find version abc1234. What is the probable cause?
Show answer
A short commit SHA was used. Refs pinned to a commit must be the full 40-character SHA, or you must use a tag or branch instead.