Skip to content
Latchkey

Terragrunt "run-all ... encountered errors" in CI

A run-all command finished with at least one unit failing, and Terragrunt prints an aggregated summary. The summary is not the root cause: the real error is in the output of the specific unit that failed, higher up in the log.

What this error means

terragrunt run-all plan/apply ends with a summary like "N errors occurred" or "run-all encountered errors", listing which unit directories failed.

terragrunt
ERRO[0042] 2 errors occurred:
  * [live/prod/db] exit status 1
  * [live/prod/app] error acquiring the state lock
ERRO[0042] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Common causes

A downstream unit failed for its own reason

The summary aggregates unit failures. Each listed directory has its own error (auth, lock, resource) earlier in the log.

A dependency failed, cascading to dependents

A unit that others depend on failed, so run-all could not proceed with the units waiting on its outputs.

How to fix it

Read the first failing unit, not the summary

  1. Scroll up to the earliest unit error in the log.
  2. Fix that unit in isolation with --terragrunt-working-dir.
  3. Re-run run-all once the root unit passes.
Terminal
terragrunt plan --terragrunt-working-dir live/prod/db

Keep going to collect all failures at once

Use the error-handling flag so run-all reports every unit failure in one pass instead of stopping early.

Terminal
terragrunt run-all apply --terragrunt-ignore-dependency-errors

How to prevent it

  • Fix and validate individual units before running the whole stack.
  • Keep dependencies explicit so failures do not cascade silently.
  • Run run-all plan in CI to surface unit errors before apply.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →