Skip to content
Latchkey

Terragrunt "NoSuchBucket" remote state error in CI

The S3 backend Terragrunt generated points at a bucket that does not exist, is in another region, or is invisible to the runner credentials. Terraform returns "NoSuchBucket" when it tries to read or write state.

What this error means

terragrunt init or apply fails with "Error: Failed to get existing workspaces: ... NoSuchBucket: The specified bucket does not exist", naming your state bucket.

terragrunt
Error: Failed to get existing workspaces: operation error S3: ListObjectsV2,
https response error StatusCode: 404, ... NoSuchBucket: The specified bucket does not exist
  status code: 404, bucket: acme-tfstate

Common causes

The state bucket does not exist yet

The bucket in remote_state.config.bucket was never created, or Terragrunt auto-bootstrapping is disabled so it will not create it.

Wrong region or credentials without access

The bucket exists in another region, or the CI IAM role cannot see it, so S3 responds as if it does not exist.

How to fix it

Create or bootstrap the state bucket

Let Terragrunt create the bucket on first init, or provision it out of band before CI runs.

Terminal
# Terragrunt can create the S3 bucket and lock table on first init
terragrunt init --terragrunt-non-interactive

Fix region and credentials

  1. Confirm the bucket name and its region match remote_state.config.
  2. Ensure the CI role can list and read/write the bucket.
  3. Re-run init once access is correct.
.github/workflows/ci.yml
env:
  AWS_REGION: us-east-1
  AWS_ROLE_ARN: ${{ secrets.TF_STATE_ROLE }}

How to prevent it

  • Provision the state bucket and lock table before pipelines run.
  • Keep the backend region consistent with the bucket region.
  • Grant the CI role least-privilege access to the state bucket.

Related guides

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