Troubleshooting and Debugging
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Workflows fail in three broad ways: they never start, they start and fail, or they succeed but do the wrong thing. Each
has a different toolbox. This page starts with reading logs and turning on debug output, then covers the usual reasons a
workflow does not trigger, the permission and expression errors that account for most red runs, and the tools that let
you find mistakes before pushing. Tool versions are those verified on 2026-11-10 (actionlint 1.7.12); the official
documentation wins on any discrepancy. The running example is this site’s nightly publish.yml, whose typical failures
(a schedule that stops firing, a Mermaid validation failure, a Pages push without permission) appear throughout.
Reading logs
Open the run, then the failed job; every step is a collapsible group and the failing step is expanded. Useful details:
-
The Set up job step lists the runner image version, the
GITHUB_TOKENpermissions actually granted, and every action with its resolved SHA. -
Lines are timestamped (toggle with the gear menu); search the log with the search box and download the raw log from the same menu.
-
::group::and::endgroup::workflow commands fold your own output;::error file=app.js,line=10::messagecreates an annotation on the diff. -
The first error is usually the root cause; later steps fail as a consequence. Steps after a failure are skipped unless they have
if: always()orif: failure().
gh run list --workflow publish.yml --limit 5
gh run view 123456789 --log-failed # only the logs of failed steps
gh run view 123456789 --job 987654321 --log # one job in full
gh run watch 123456789 # follow a run in the terminal
gh api repos/OWNER/REPO/actions/runs/123456789/logs > logs.zip
Re-running and debug logging
Re-run from the UI (Re-run failed jobs, Re-run all jobs) or the CLI. A re-run uses the same commit, the same workflow file version and the same event payload, so it reproduces the original conditions; it increments the run attempt, and logs of earlier attempts stay available.
gh run rerun 123456789 --failed # only the failed jobs and their dependents
gh run rerun 123456789 --debug # all jobs, with debug logging on
gh run rerun 123456789 --failed --debug
The UI offers Enable debug logging in the re-run dialog. Debug logging can also be enabled permanently by creating a
secret or variable named ACTIONS_STEP_DEBUG set to true (extra step output from actions), and ACTIONS_RUNNER_DEBUG
set to true (runner diagnostics, including internal logs and the diagnostic log archive). Turn them off again; the
output is verbose and may reveal values that masking does not cover.
You can print your own diagnostics that appear only in debug mode:
- run: |
echo "::debug::resolved version is $VERSION"
echo "::warning file=antora-playbook.yml,line=12::source branch pattern matches nothing"
env:
VERSION: ${{ steps.version.outputs.version }}
Dumping contexts is the fastest way to see what an expression receives:
- name: Dump contexts
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
JOB_CONTEXT: ${{ toJSON(job) }}
run: |
echo "$GITHUB_CONTEXT"
echo "$JOB_CONTEXT"
Never dump the secrets context, and remove these steps once the problem is solved.
The workflow did not run
Common causes in more detail:
-
Default branch:
scheduleruns only from the default branch’s copy of the file, andworkflow_dispatchshows the Run workflow button only when the file exists on the default branch. Cron times are UTC and may be delayed by several minutes under load; the shortest interval is five minutes. -
Inactivity: in public repositories, scheduled workflows are disabled automatically after 60 days with no repository activity. A nightly site build still fires only if the repository (or something that counts as activity) changes, so re-enable it from the Actions tab or push a commit.
-
Path and branch filters:
pathsfilters compare against changed files; a filter on a tag push is ignored. Filters combine with AND acrossbranchesandpaths.paths-ignoreandpathscannot be used together for the same event. -
Tokens do not chain: a push, tag or pull request created by a workflow with
GITHUB_TOKENdoes not trigger other workflows (exceptworkflow_dispatchandrepository_dispatch). Use a GitHub App token or a personal access token. -
Forks: first-time contributor runs wait for maintainer approval, and
pull_requestworkflows from forks have no secrets. -
Skip markers:
[skip ci],[ci skip],[no ci],[skip actions]or[actions skip]in the commit message skippushandpull_requestruns. -
YAML errors: an invalid file is not run at all and shows a red banner on the workflow page. Validate with
actionlintbefore pushing. -
Merge conflicts:
pull_requestworkflows do not run while the PR has a merge conflict, because there is no merge commit to test.
Permission errors
Resource not accessible by integration means the GITHUB_TOKEN lacks a scope the step needs. Read the permissions in
the Set up job log, then grant exactly the missing one:
permissions:
contents: write # push a commit, create a release
pull-requests: write # comment on or label a PR
issues: write # comment on an issue (PR comments through the issues API too)
pages: write # deploy-pages
id-token: write # request an OIDC token
packages: write # push to GHCR
Remember that declaring any permissions sets every unlisted scope to none, and that PRs from forks and Dependabot
get a read-only token regardless. For 403 on git push, check persist-credentials in checkout and branch
protection, which a token cannot bypass. See Security Hardening.
Expression and quoting pitfalls
# 1. Conditions: the ${{ }} is optional in if:, and mixing text with it makes the whole thing a non-empty string (true)
if: ${{ github.ref == 'refs/heads/main' }} # fine
if: github.ref == 'refs/heads/main' # fine, preferred
if: "${{ github.event_name }} == 'push'" # WRONG: always true, it is a non-empty string
# 2. Booleans from workflow_dispatch and env are strings in some contexts
if: inputs.dry-run == false # boolean input: works
if: github.event.inputs.dry-run == 'false' # event.inputs are strings: compare with a string
if: env.DEPLOY == 'true' # env values are always strings
# 3. A YAML key named on can be parsed as the boolean true by some YAML 1.1 tools
on: [push] # GitHub accepts it; lint with actionlint
# 4. Strings starting with special characters need quotes
run: echo "step: one" # a colon followed by a space needs quoting
node-version: 24 # a number; for 3.10 write '3.10' or it becomes 3.1
More pitfalls:
-
Multi-line scripts need
run: |; with>the lines are folded into one and the commands run together. -
${{ }}is substituted before the shell runs, so quotes inside values break the script: pass values throughenv:(see Security Hardening). -
Comparisons are case-insensitive for strings in expressions, but
containson arrays is exact. -
needs.job.outputs.xis empty when the job was skipped or the output was not declared inoutputs:at job level. -
if:on a job referencingstepsfails: thestepscontext is not available at job level. -
An
if:withoutalways()is implicitlysuccess(), so a cleanup step after a failure is skipped. -
The default shell for
runon Linux isbash -e {0}; addshell: bashon Windows for the same behaviour, and note thatpipefailis set only with an explicitshell: bash.
Caches, matrices, timeouts and resources
-
Cache misses: the key changed (a lock file hash,
runner.os), the cache was evicted when the repository passed its size limit, or the cache was written on a branch the current ref cannot read (a PR reads its base branch and its own caches, never a sibling’s). Printsteps.cache.outputs.cache-hitto confirm; see Caching and Artifacts. -
Matrix problems: a value such as
3.10parsed as a number, anincludeentry that does not extend existing combinations, anexcludethat matches nothing, orfail-fast: truecancelling siblings when one leg fails. PrinttoJSON(matrix)and setfail-fast: falsewhile diagnosing. See Jobs, Steps and Matrix. -
Timeouts: a job is cancelled when it exceeds
timeout-minutes(default 360). Set a realistic value per job and per step; a hung network call otherwise burns minutes. -
Cancellations: a run marked cancelled with nobody pressing the button usually comes from
concurrencywithcancel-in-progress: true, afail-fastmatrix, or a newer push to the same group. Check the group expression. -
Out of disk space: hosted runners have limited free space, and Docker builds, Android SDKs and large caches fill it. Check with
df -h, remove unused preinstalled toolchains (/usr/local/lib/android,/opt/hostedtoolcache) as a first step, or use a larger runner. See Runners. -
Rate limits:
403or429responses from the GitHub API mean the token’s hourly limit is exhausted. Authenticate everyghor API call withGH_TOKEN, cache results, and avoid loops over many repositories without back-off. Docker Hub pulls and npm registries have their own limits; mirror or authenticate.
Local tooling
# static analysis of workflow files: syntax, expressions, shellcheck on run steps, injection patterns
brew install actionlint # or: go install github.com/rhysd/actionlint/cmd/actionlint@latest
actionlint
actionlint -shellcheck= .github/workflows/publish.yml # disable shellcheck integration
# run workflows locally in Docker with act (approximation, not identical to GitHub-hosted runners)
brew install act
act -l # list jobs
act push -j publish --container-architecture linux/amd64
act workflow_dispatch -s GITHUB_TOKEN="$(gh auth token)"
# trigger and inspect from the CLI
gh workflow list
gh workflow run publish.yml --ref main -f version=1.4.0
gh workflow view publish.yml --yaml
gh workflow disable publish.yml && gh workflow enable publish.yml
act is useful for quick feedback on shell steps but has limits: it uses smaller images by default, lacks many
GitHub-provided services, does not implement OIDC, caches or artifacts the same way, and ignores environment
protection rules. Treat a local pass as a hint, not proof. actionlint has no such caveat for what it checks and fits
well in a pre-commit hook or a CI job of its own.
Interactive debugging with tmate
Actions such as mxschmitt/action-tmate open an SSH session into a running job. This can be the only way to inspect a
runner, but it exposes the job, its secrets and the workspace to anyone with the connection string. Use it only on
private repositories or with limit-access-to-actor: true, never in workflows that run for pull requests from forks,
pin it to a commit SHA, and remove it as soon as the problem is solved.
Observability
-
Job summaries: write Markdown to
$GITHUB_STEP_SUMMARYand it appears on the run page:{ echo "### Antora build" echo "- Pages: $(find build/site -name '*.html' | wc -l)" echo "- Duration: ${SECONDS}s" } >> "$GITHUB_STEP_SUMMARY" -
Annotations:
::error,::warningand::noticecommands show on the run page and, withfileandline, on the pull request diff. Problem matchers can turn compiler output into annotations automatically. -
Workflow visualization: the run page draws the job graph from
needs, with live status; a graph that is flatter than expected means a missingneeds. -
Usage metrics: Insights > Actions Usage Metrics (organization) and Actions Performance Metrics show run counts, durations, failure rates and runner minutes per workflow, job and runner type; the billing page shows spend.
Symptom, cause and fix
| Symptom | Likely cause | Fix |
|---|---|---|
Workflow never appears in the Actions tab |
File is outside |
Move or rename; run |
Scheduled run stopped after weeks |
Public repo inactivity (60 days) or workflow disabled |
Re-enable in the Actions tab; add periodic activity |
|
Token lacks a permission |
Add the exact scope under |
Push from a workflow does not trigger another workflow |
Events from |
Use a GitHub App token or PAT, or call the other workflow with |
|
Expression mixed with text, so it is a non-empty string |
Write the whole condition as one expression |
Input comparison fails |
Boolean versus string in |
Use the |
Cache never hits |
Key includes a changing value, or cache written from an unreadable ref |
Key on the lock file hash; check |
Matrix leg missing or wrong version |
Number parsed from YAML ( |
Quote versions; print |
Run cancelled unexpectedly |
|
Adjust the group and flags; set |
|
Large builds, Docker layers, SDKs |
Free space early, or use a larger runner |
|
Unauthenticated or heavy API use |
Pass |
Fork PR has no secrets |
By design for |
Use the split |
Common mistakes
-
Re-running instead of reading: the first failing line almost always names the cause.
-
Leaving
ACTIONS_STEP_DEBUGor context dumps enabled after debugging. -
Debugging a cron schedule on a branch other than the default, where it never fires.
-
Editing a workflow and testing on a PR from a fork: the base branch’s secrets and file rules apply differently.
-
Treating
actsuccess as proof of GitHub-hosted behaviour. -
Opening a tmate session in a public repository with secrets loaded.
References
-
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows
-
https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging
-
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands
-
https://docs.github.com/en/actions/reference/workflows-and-actions/contexts