Skip to content
Latchkey

Terraform "Failed to read module manifest" in CI

Terraform reads .terraform/modules/modules.json to know where each installed module lives. When that manifest is missing, truncated, or invalid JSON, init or plan fails because the module layout cannot be resolved.

What this error means

terraform init or plan stops with "Error: Failed to read module manifest" and a JSON or file-read error for .terraform/modules/modules.json.

Terraform
Error: Failed to read module manifest

Module installer was unable to read the manifest file
".terraform/modules/modules.json": unexpected end of JSON input.

Common causes

A partial or corrupt cache of .terraform

A cache restore that ran mid-write, or an interrupted previous init, left modules.json truncated or invalid.

A stale manifest carried across incompatible changes

An old manifest from a different config layout no longer parses cleanly against the current modules.

How to fix it

Delete the module cache and re-init

  1. Remove the .terraform/modules directory (or all of .terraform).
  2. Run terraform init to rebuild the manifest from scratch.
  3. Re-run plan against the clean install.
Terminal
rm -rf .terraform/modules
terraform init -input=false

Do not cache a half-written .terraform

Cache .terraform only after a successful init, and key it on the config so partial state is not restored.

How to prevent it

  • Rebuild .terraform/modules with a fresh init when the manifest is corrupt.
  • Avoid caching .terraform from failed or interrupted jobs.
  • Key module caches on config and lock files.

Frequently asked questions

What causes ""Failed to read module manifest""?
A cache restore that ran mid-write, or an interrupted previous init, left modules.json truncated or invalid.
How do I fix "Failed to read module manifest"?
Delete the module cache and re-init

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card