> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trunk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> What to check when Dynamic CI runs every job, never skips a job, or skips one it shouldn't.

Start with the Dynamic CI step's log in your CI run: it prints the plan, or
the reason no plan was made. On Buildkite, set the plugin's `debug: true` to
also print the request.

## Every job ran

When the step prints **Every job will run** with a reason, follow the
instructions in the output. The code in brackets at the end names the case:

| Code or message | What to do |
| - | - |
| `REPO_IN_SHADOW_MODE` | Nothing is wrong: the repository is in [Learning mode](https://docs.trunk.io/dynamic-ci/configuration/mode.md), which records verdicts and skips nothing. Switch it to **Enforced** when the recommendations look right. |
| `WORKFLOW_NOT_RECOGNIZED` | Let one run of the workflow finish, then push again. |
| `MERGE_QUEUE_REQUIRED` | Set up Trunk Merge Queue or GitHub's merge queue on the default branch. See [What Enforced mode needs](https://docs.trunk.io/dynamic-ci/configuration/mode.md#what-enforced-mode-needs). |
| `BILLING_PAUSED` | An admin adds a payment method, or pays the open invoice, in [Billing](https://app.trunk.io/settings/organization/billing). |
| `BUILDKITE_API_KEY_REQUIRED` | Connect a Buildkite API key with the `read_builds` scope in [Buildkite settings](https://app.trunk.io/settings/organization/buildkite). Skips resume on a later build. |
| `ORG_NOT_ENABLED`, `REPO_NOT_ENABLED` | [Ask us](https://slack.trunk.io) to turn Dynamic CI on. |
| `ENGINE_UNAVAILABLE`, or a timeout | Nothing to do. Trunk could not answer in time, so every job ran; the next push gets a plan. |
| The token input is empty | Store a Trunk API key as `TRUNK_API_TOKEN` and pass it to the action's `token` input. |
| The pull request comes from a fork | Expected. A fork's pull request gets no secrets, so Dynamic CI doesn't decide its jobs. |
| `403` | The API key lacks the **Generate Dynamic CI plans** permission. Make a new key with it in [API Keys](https://app.trunk.io/settings/developer/api-tokens) and replace the secret. |
| `404` | Trunk has no CI data for this repository in your organization. Check that both GitHub apps cover it (on Buildkite, that the [OpenTelemetry export](https://docs.trunk.io/setup/integrations/buildkite.md) works and the pipeline's repository matches), let one run finish, and push again. |

## A job never skips

* **It is new or rarely runs.** A job with fewer than about 10 runs in the
  last 7 days usually runs: Dynamic CI doesn't have enough history to skip it.
* **It is required and there is no merge queue.** A job a merge needs, or a job
  a required job `needs:`, always runs unless a merge queue runs it again
  before merge. Set up a merge queue.
* **Its schedule is Always Run.** Check it in [Configuration → Jobs](https://docs.trunk.io/dynamic-ci/configuration/jobs.md).
* **The pull request is in Learning mode** and not on the [allow list](https://docs.trunk.io/dynamic-ci/configuration/mode.md#allow-list).
* **The job doesn't read its verdict.** On GitHub Actions, its `if:` must
  compare `needs.dynamic-ci.outputs.<job>` with `!= 'false'`. On Buildkite,
  the step needs a `key:` and must be in the pipeline you pipe through the
  filter.

## A job was skipped and should have run

* **See why.** The pull request's Dynamic CI tab, and Decisions on the
  [Dynamic CI page](https://app.trunk.io/dynamic-ci), show each decision and
  what decided it.
* **Run it now.** [Force Run](https://docs.trunk.io/dynamic-ci/force-run.md) the job, then rerun.
* **A path filter skipped it.** A rule skip never counts as a false skip, so a
  filter that leaves out a path the job needs skips it with no warning. Check
  the job's [path filters](https://docs.trunk.io/dynamic-ci/configuration/path-filters.md).
* **The pull request is a draft.** With the Draft PR gate on, jobs are skipped
  until the pull request is ready for review, and the step says so. Mark it
  ready, submit it to the merge queue, or Force Run the job.
* **The agent skipped it.** See [Reduce false skips](https://docs.trunk.io/dynamic-ci/guides/reduce-false-skips.md).

## A job is missing from Configuration → Jobs

The Jobs tab lists a job once Dynamic CI has decided it in the last 14 days, or
once you change its settings. A job with no decision in the last 30 days and no
settings is listed as **Unmanaged** instead. Wire it up as on the
[GitHub Actions](https://docs.trunk.io/dynamic-ci/getting-started/github-actions.md) or
[Buildkite](https://docs.trunk.io/dynamic-ci/getting-started/buildkite.md) page, and it appears after
its next run.

## Run Before Queue holds the pull request

The pull request's readiness says why. See
[Failed to start](https://docs.trunk.io/dynamic-ci/run-before-queue.md#failed-to-start) for the common
causes and how to unblock it.

## Buildkite

* **`baseSha` is null on a pull request build.** Fetch the target branch before
  the upload step.
* **Builds without a pull request**, such as pushes to your default branch, can
  be skipped. To force a step, use [Force Run](https://docs.trunk.io/dynamic-ci/force-run.md#trunk-web-app)
  in the Trunk web app.

## Get help

[Reach out on Slack](https://slack.trunk.io) with the repository, a link to the
pull request, and the Dynamic CI step's log.
