Skip to content

Troubleshooting

The failures you are most likely to hit, one heading per symptom as it appears in the job log, the check row, or the pull request comment. Each entry names the cause and the fix. Procedures that take more than a few steps live in the Runbook.

A job fails at startup with an OIDC or environment error

The OIDC subject binds the repository and the environment name. Only the Azure jobs (the plan matrix, apply, unlock, drift-plan, and drift's lock-sweep) request an id-token. resolve, gate and drift's report bind the plan environment to read the checks App key but request no token, and discover and the PR caller's dispatch bind no environment at all. The reusable workflow already keeps this split, so the caller does not need to. If a login fails, confirm the federated credential subject matches the repository and environment. Repos created after GitHub's immutable-id rollout use the repo:org@id/repo@id:environment:env form; the bootstrap builds subjects in that format by default and only uses the legacy name-only form when oidc_subject_uses_repo_ids is set false.

The engine runtime install fails

Every job starts with "Install the engine runtime", which downloads the tfpr binary and the gate scripts from the public release the caller pins and checks them against the SHA256SUMS committed in the public repository at the pinned tag. There is no fallback, so a failure stops the job.

  • "no engine runtime for '...': pin the caller to a release tag": the caller's uses: ref is a branch or a commit. Pin an exact vX.Y.Z tag.
  • "cannot download ... from the ... release": the runner cannot reach the release download hosts. Allow api.github.com, github.com and release-assets.githubusercontent.com over HTTPS; see License requirements.
  • "checksum mismatch": a proxy changed the download, or it was cut off. Re-run the job; if it repeats, check the proxy. The same message also means a release asset no longer matches the tagged tree, which an immutable release makes impossible by accident.
  • A transient 502 from the release download hosts fails the plan with "Plan failed: fix the error, then comment tfpr plan". Comment tfpr plan.

tfpr apply is refused with "Plan only"

The license or entitlement is missing, not valid, or revoked, or the revocation list is too old. The message names the cause and links to the fix on License. Plans, drift and tfpr unlock keep working meanwhile.

The secrets do not reach the engine from another organization

The ops or drift caller still uses secrets: inherit, which GitHub honours only when the caller is in the same organization as the reusable workflow. Replace it in tfpr.yml and drift.yml with the secrets: block from the example callers (see The PR-ops engine). If the callers already pass the secrets by name, the secret itself is missing.

The run uses the wrong engine version

Each caller pins the engine with its uses: ref, and each job installs the runtime of that release, so the workflow and the engine code always match. If the callers disagree, the pull request path and the comment path run different engines. Bump every uses: ref together. Remove any engine_ref input left from before v9: the v9 workflows do not declare it, and GitHub fails the run on an unknown input.

Discovery fails with "a hook is now a mapping with a name"

The repository moved to engine v7 but projects.yml still lists its hooks as plain command strings. Each hook is a mapping, and discovery refuses the old form and prints the edit for the first hook it finds. Give every hook a name and move its command under run:; replace CHECKOV_SOFT_FAIL=1 with on_failure: warn. Do the pin bump and the migration in the same pull request, on v7.0.2 or later. See Upgrading from engine v6.

A manual dispatch is refused without a PR number

Dispatching the ops caller (tfpr.yml) by hand without the pr_number input is refused at parse, with a message saying a full plan of the default branch belongs to drift.yml instead. Every plan, apply, and unlock drives a pull request; set pr_number to the PR the dispatch should act on.

A pull request from a fork fails at discover

The engine rejects fork pull requests explicitly: discover and resolve fail with "fork pull requests are not supported". Push the branch to the repository itself instead; these are private single-team repositories, so a fork adds no value the engine can use.

A plan row reads "Failed" with no report comment

The plan stopped before Terraform ran, usually while installing the tools your mise.toml pins (a version that does not exist, or a download that failed). There is no plan, so there is no report. Open the row's details: the link goes to the job, and the failed step names the cause. Fix it and comment tfpr plan.

A plan reports a unit locked by another PR

  • Another open pull request planned the same unit first and owns it until it merges or closes. The report comment names the owning PR.
  • Normal path: wait for the owning PR, or get it merged or closed. Its locks release automatically and the next plan on your PR acquires the unit.
  • If the owning PR is parked, comment tfpr unlock on that PR (not yours) to force-release its locks.
  • A lock naming a PR that is already closed or merged clears itself two ways: the next plan that wants the unit reclaims it, and the daily drift run's lock sweep releases every lock whose holder is closed. If closed PRs keep leaving locks behind, the unlock caller is the thing to check: .github/workflows/tfpr-unlock.yml must exist and trigger on pull_request: types: [closed], per the canonical caller.
  • See Cross-PR unit locks.

The merge gate never turns green

  • Make sure tfpr / merge-gate is a required status check and that the name matches exactly.
  • The gate is red while a unit has unapplied changes. Run tfpr apply and let it finish.
  • If a plan or apply errored, the gate is red until the error is fixed and the unit re-planned or re-applied.
  • If the PR changed Terraform but no unit was selected, the gate blocks on purpose. Paths that gate_ignore on the default branch names do not count; if the entry is in the same PR, land it first. Comment tfpr plan to see what is discovered, and confirm the changed unit is a real Terragrunt unit on the branch.
  • Deleting a whole unit directory does not block. The gate reports N unit(s) removed; its resources keep running, see the PR comment and passes. It still blocks if the same PR also adds a unit, because the removal then does not account for every changed Terraform path. See Removed units.

A command is refused because the pull request is not open

tfpr plan, tfpr apply and tfpr unlock run on open pull requests only. On a closed or merged one the reply reads "Command refused: This PR is not open, so tfpr apply was not run. Reopen the PR, then comment tfpr apply again." Locks of a closed pull request are released by the unlock caller; a manual workflow_dispatch of the ops caller with command: unlock and the PR number still works for a close event that produced no run.

tfpr apply says it is blocked

Read which of the three messages you got.

  • "This PR does not have the approving reviews this repository requires". The PR needs approving reviews it does not have. Get the approvals the branch protection or ruleset requires, then comment tfpr apply again.
  • "The approval on this PR predates the latest push". The PR is approved, but no approving review sits on the head commit: someone pushed after the review and the ruleset keeps stale approvals. The engine ties the approval to the head commit and to a reviewer with write access. Have the reviewer approve the current commit, then comment tfpr apply again. A ruleset that dismisses stale reviews on push shows the missing-reviews message instead.
  • "This repository requires no pull request reviews". The repository requires no approving reviews at all, so GitHub reports no review decision and the engine refuses. There is nothing to approve here, so approvals cannot clear it. Either set a required approving review count on the main branch, or, if the repository requires none on purpose, set the TFPR_ALLOW_UNREVIEWED_APPLY repository variable to true. See Secrets and variables.

The same distinction shows in the tfpr / approval check run's description.

The approval row stays red after an approval

The review caller refreshes the row about 20 seconds after a review is submitted or dismissed. If it stays red:

  • Check that .github/workflows/tfpr-review.yml exists and triggers on pull_request_review: types: [submitted, dismissed], and that the ops caller's command options include review. Engines before v11.0.0 have neither, and refresh the row only at the next run.
  • A refresh row that is green with a red ops run usually means the ops caller on main lacks the review option (HTTP 422 in the refresh log).
  • The row follows the same rules as the apply gate: an approval of an older commit, or by someone without write access, does not count.

An apply is refused with "Plan changed since review"

The reviewed-plan guard. The plan taken at apply time does not match the plan that was reviewed, or the current commit has no plan report at all, so the engine refuses to ship something nobody read. The report comment shows the difference at resource-action level. The reviewed plan is read from the unit's check run on the head commit, which only the checks App can write; a plan marker pasted into a comment by anyone else is ignored. Two causes:

  • Something moved between review and apply: an out-of-band portal change, drift, or a data source resolving differently. Comment tfpr plan, review the new plan, then tfpr apply again.
  • The branch was pushed after the last plan. The automatic plan for the new commit may still be running, or was never read. Wait for it (or comment tfpr plan), review, then tfpr apply. If the push landed during an apply, the new commit's plan rows read Waiting for apply #N on <sha> until that apply finishes; the plan then runs by itself.

To apply the current plan without a re-review, comment tfpr apply --force. See the reviewed-plan guard.

The gate is red with "Discovery disagrees with the changed files"

The engine checks what discovery selected against the changed files, without evaluating any HCL from the pull request. The gate fails when the selection falls short of what the files demand, and the gate job's log names the first reason:

  • "<unit> has changed files but was not selected": a file inside that unit's folder changed, but discovery left the unit out. Look for an exclude in the pull request's projects.yml or a unit that no longer parses; comment tfpr plan after fixing it.
  • "<unit> reads changed file <file> but was not selected": a shared file (tenant.hcl, region.hcl, a file root.hcl reads) changed, and on the default branch that unit reads it. The map comes from the default branch, so a pull request cannot shrink its own run by editing HCL.
  • "<unit> is reported removed but is still a unit in the head tree": discovery claimed the unit was deleted, but its folder still holds a terragrunt.hcl on the branch. Removing a unit means deleting its folder; excluding it in projects.yml is not a removal.

The gate is red with "Engine paths in the pull request"

The pull request adds or changes files under .tfpr-engine/ or gate/. Both paths belong to the engine (the runtime it installs and the gate results it writes), so the run is refused before anything plans. The gate title reads "Engine paths in the pull request: remove .tfpr-engine/ and gate/", and its summary names the path. Delete the files from the branch and push.

The gate is red because a run stopped before planning

Since v11.0.0 a run the engine refuses before planning still fails tfpr / merge-gate, with the reason as the title:

Gate title Cause and fix
Engine paths in the pull request: remove .tfpr-engine/ and gate/ See above.
Head moved during discovery: comment tfpr plan again A push landed while the run read the tree. The run for the new push follows; if it does not, comment tfpr plan.
Discovery did not finish: see the discover job log The discover job failed, usually on HCL that does not parse. Its log names the file.
Discovery output is not valid: see the discover job log The same job produced output the engine cannot read. Comment tfpr plan; if it repeats, the discover log shows why.
Engine run stopped early: see the run log Any other failure before planning. Open the ops run from the gate's details link.

Engines before v11.0.0 wrote no gate row in these cases: the pull request showed only green pre-commit and dispatch rows, and the reason was only in the red ops run.

The gate is red with "Terraform path(s) changed outside the planned units"

The unattributed-path check. The PR changes a Terraform-pattern path (.tf, .hcl, .tfvars, and friends) that no selected unit accounts for, so merging would ship a change nothing planned. The gate title names the paths when they fit; the gate job's log always lists them. Three causes:

  • A shared file no unit reads changed (a local module tree, a template, a subscription.hcl in a folder with no unit yet). A shared file is attributed to the units that read it on the default branch, from Terragrunt's own reading map, so this case is left for files nothing reads. A new shared file the PR introduces is read by nobody on the default branch yet; it passes when every unit planned in the same PR, which a root.hcl edit that reads it brings about. Otherwise restructure so the file lives under a unit or is read by one, or accept it with a gate_ignore: entry.
  • A stray tooling file matches the Terraform pattern (.tflint.hcl, a vendored example). Add it to gate_ignore: in projects.yml; the reference repositories ship entries for the files they carry.
  • A path was renamed across units. The deletion side belongs to no current unit. The removed-unit report usually explains it; read that comment first.

The merge gate mentions caller drift

The gate's text reads Caller drift: N differences from the vX.Y.Z examples, see the resolve job's warnings. One of the five caller workflows on the default branch no longer matches the example the running engine version ships: a trigger type, a permission, or an input, condition or secret on a job that calls the engine. Open the run's resolve job: each warning names the file, the place, and the example's value. Copy the example's value into the caller in a pull request. The warning never blocks a merge, and the repository's own jobs, such as the pre-commit job, are not compared.

A tfpr plan or tfpr apply comment is refused as unauthorized

The engine accepts commands only from a comment whose author_association is OWNER, MEMBER, or COLLABORATOR. Any other author gets a 😕 reaction and a reply saying they are not authorized. Add the person as a repository collaborator or an organization member, or have someone who already qualifies run the command. See Who can run a command.

The cost gate shows "skipped"

infracost needs a key. Set the INFRACOST_API_KEY secret and add infracost to the TFPR_EXTRA_TOOLS variable. Use a static key from the Infracost dashboard (the legacy line), not the newer OAuth CLI flow.

The key also has to be named under extra_env in projects.yml on the default branch, or the gate never sees it and reads "skipped, no INFRACOST_API_KEY" although the secret exists. See The extra_env block.

A hook stopped seeing GH_TOKEN

Terraform, Terragrunt and hooks run with an allow-listed environment, and the workflow token, the checks App token and the Infracost key are not in it. A hook that posted to GitHub belongs in a workflow step after the engine job. Any other variable a hook needs is forwarded by naming it under extra_env in projects.yml on the default branch; review that list like code, because pull request code in the plan job can read every name on it. Hooks themselves are read from the default branch too, so the pull request that adds a hook does not run it; the next one does.

infracost reports "not installed"

The INFRACOST_API_KEY secret is set, but infracost is not in the TFPR_EXTRA_TOOLS variable. Add it. Without a key the cost gate reads "skipped" instead.

checkov reports "not installed"

checkov is baked into the self-hosted runner image. If you run on a hosted runner without the baked image, set TFPR_EXTRA_TOOLS to include checkov on a Python-capable runner, or use the baked runner image.

conftest reports "no policies found"

The row reads "skipped, no policies" and the comment names the directory it searched. Expected until you write rego: put .rego files in policy/. To use another directory, set CONFTEST_POLICY_DIR in the hook's run command, as the gate hooks explain. A job-level variable does not reach the hook.

A runner is OOM-killed and leaves a stale state lock

The heaviest ALZ policy-library plans need more than the AVM runner defaults (1 vCPU, 2Gi, 1800-second timeout). Undersized, the plan OOM-hangs and the replica timeout kills the runner mid-job, which can leave a stale state lock. The bootstrap sizes replicas at 2 vCPU, 4Gi, and a 7200-second timeout through container_app_container_cpu, container_app_container_memory, and container_app_replica_timeout. If you see this, confirm those values are applied. The runbook has the full procedure for clearing a stale lock safely.

The bootstrap plan always shows an ACR bypass revert

This happens only on the bootstrap's build-from-source fallback (runner_image_commit set). The default path imports the published image and has no build task. On the fallback, the bootstrap plan permanently shows azurerm_container_registry.this wanting to set network_rule_bypass_for_tasks_enabled back to false. Never apply it: the flag is owned by an azapi patch the runner-image build depends on, and reverting it breaks the next image build. The bootstrap README carries the exact restore command if it is ever applied by accident.

Plan cannot reach state

State sits behind a firewall that allows the runner's egress address. Confirm the job ran on the self-hosted runner (RUNNER_LABEL is set) and that the runner's egress address is still allowed on the state account firewall. Both identities hold Storage Blob Data Contributor on the state container; the plan side plans without the state lock. A 403 on the state blob means the role assignment is missing. A 403 followed by "The specified blob does not exist" on a new unit means the plan identity has only read: it cannot create the unit's state blob at init. The bootstrap grants Contributor to both since 2026-10-15.

A version constraint fails

Pin Terraform and Terragrunt in mise.toml. The built-in fallback versions are only used when no version manager is present, and they may not satisfy a unit's constraint (for example a unit requiring >= 1.12).