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_TOKEN permissions 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::message creates 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() or if: 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

flowchart TD A[Workflow did not run] --> B{Does the file exist on the branch the event targets?} B -- no --> B1[Schedule and workflow_dispatch need the file on the default branch] B -- yes --> C{Is it listed in the Actions tab?} C -- no --> C1[YAML error or wrong path: must be .github/workflows/name.yml] C -- yes --> D{Is the workflow disabled?} D -- yes --> D1[Enable it; scheduled workflows in public repos are disabled after 60 days without repository activity] D -- no --> E{Does the event, branch and path filter match?} E -- no --> E1[Check branches, tags, paths, paths-ignore and types] E -- yes --> F{Was the event created with GITHUB_TOKEN?} F -- yes --> F1[Events from GITHUB_TOKEN do not start workflows: use a PAT or App token] F -- no --> G{Is it a fork or a skipped commit?} G -- yes --> G1[Fork approval pending, or skip ci in the commit message] G -- no --> H[Check run list, organization policy and billing limits]

Common causes in more detail:

  • Default branch: schedule runs only from the default branch’s copy of the file, and workflow_dispatch shows 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: paths filters compare against changed files; a filter on a tag push is ignored. Filters combine with AND across branches and paths. paths-ignore and paths cannot be used together for the same event.

  • Tokens do not chain: a push, tag or pull request created by a workflow with GITHUB_TOKEN does not trigger other workflows (except workflow_dispatch and repository_dispatch). Use a GitHub App token or a personal access token.

  • Forks: first-time contributor runs wait for maintainer approval, and pull_request workflows from forks have no secrets.

  • Skip markers: [skip ci], [ci skip], [no ci], [skip actions] or [actions skip] in the commit message skip push and pull_request runs.

  • YAML errors: an invalid file is not run at all and shows a red banner on the workflow page. Validate with actionlint before pushing.

  • Merge conflicts: pull_request workflows 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 through env: (see Security Hardening).

  • Comparisons are case-insensitive for strings in expressions, but contains on arrays is exact.

  • needs.job.outputs.x is empty when the job was skipped or the output was not declared in outputs: at job level.

  • if: on a job referencing steps fails: the steps context is not available at job level.

  • An if: without always() is implicitly success(), so a cleanup step after a failure is skipped.

  • The default shell for run on Linux is bash -e {0}; add shell: bash on Windows for the same behaviour, and note that pipefail is set only with an explicit shell: 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). Print steps.cache.outputs.cache-hit to confirm; see Caching and Artifacts.

  • Matrix problems: a value such as 3.10 parsed as a number, an include entry that does not extend existing combinations, an exclude that matches nothing, or fail-fast: true cancelling siblings when one leg fails. Print toJSON(matrix) and set fail-fast: false while 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 concurrency with cancel-in-progress: true, a fail-fast matrix, 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: 403 or 429 responses from the GitHub API mean the token’s hourly limit is exhausted. Authenticate every gh or API call with GH_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_SUMMARY and 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, ::warning and ::notice commands show on the run page and, with file and line, 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 missing needs.

  • 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 .github/workflows, wrong extension, or YAML syntax error

Move or rename; run actionlint

Scheduled run stopped after weeks

Public repo inactivity (60 days) or workflow disabled

Re-enable in the Actions tab; add periodic activity

Resource not accessible by integration

Token lacks a permission

Add the exact scope under permissions

Push from a workflow does not trigger another workflow

Events from GITHUB_TOKEN do not start runs

Use a GitHub App token or PAT, or call the other workflow with workflow_call

if: always true

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 github.event.inputs

Use the inputs context or compare to 'true'

Cache never hits

Key includes a changing value, or cache written from an unreadable ref

Key on the lock file hash; check cache-hit

Matrix leg missing or wrong version

Number parsed from YAML (3.10 becomes 3.1), include misuse

Quote versions; print toJSON(matrix)

Run cancelled unexpectedly

concurrency with cancel-in-progress, fail-fast, timeout

Adjust the group and flags; set timeout-minutes

No space left on device

Large builds, Docker layers, SDKs

Free space early, or use a larger runner

403 rate limit exceeded

Unauthenticated or heavy API use

Pass GH_TOKEN; reduce calls

Fork PR has no secrets

By design for pull_request

Use the split workflow_run pattern, never pull_request_target with PR code

Common mistakes

  • Re-running instead of reading: the first failing line almost always names the cause.

  • Leaving ACTIONS_STEP_DEBUG or 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 act success as proof of GitHub-hosted behaviour.

  • Opening a tmate session in a public repository with secrets loaded.