Failed to download module (git/registry/path) Terraform Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Terraform: Error: Failed to download module — Could not download module "vpc" (main.tf:1) source code from "git::https://github.com/org/repo.git": error downloading

Terraform couldn't fetch a module's source (git auth, wrong ref/path, registry, network).

Exact message you may see Error: Failed to download moduleCould not download module "vpc" (main.tf:1) source code from "git::https://github.com/org/repo.git"Error: Failed to download module: error downloading 'https://'Error: Unreadable module directoryerror: could not read Username for 'https://github.com': terminal prompts disabled
Seen on: Terraform Git

Meaning

Check the source URL, ref (?ref=v1.2.3), credentials (SSH key or token for private repos: git config --global url."https://x:TOKEN@github.com/".insteadOf "https://github.com/" or SSH git::ssh://git@github.com/org/repo.git), subdirectory syntax (//modules/x), and Terraform registry version constraints. terraform init output has the underlying git error.

Common causes

  • Private repo without credentials
  • Wrong tag/ref or subdir path
  • Registry module/version not found
  • Network/proxy issues
  • SSH key not available in CI

⚡ Quick fix

  1. Test with git ls-remote URL
  2. Use correct ?ref= and //subdir syntax
  3. Configure git credentials/SSH agent in CI

Detailed fix by platform

Linux

  1. git ls-remote https://github.com/org/repo.git v1.2.3

How to diagnose

  1. Source — URL/ref?
  2. Auth — Credentials?
  3. Path — Subdir syntax?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Error building ARM Config: obtain subscription from Azure CLI — Terraform: Error: building AzureRM Client: obtaining subscription ID / Please run 'az login' to setup account (Terraform)Error building ARM Co…Invalid AWS Region — Terraform: Error: Invalid AWS Region: us-east-3 / Error: configuring Terraform AWS Provider: validating provider credentials: operation error STS: GetCallerIdentity (Terraform)Invalid AWS RegionModule not installed — Terraform: Error: Module not installed — This module is not yet installed. Run "terraform init" to install all modules required by this configuration (Terraform)Module not installedNo valid credential sources found (AWS provider) — Terraform: Error: No valid credential sources found — failed to refresh cached credentials, no EC2 IMDS role found / Error: configuring Terraform AWS Provider: no valid credential sources (Terraform)No valid credential s…publickey — Git: Permission denied (publickey). fatal: Could not read from remote repository. (Git)publickeyterminal prompts disabled / 410 Gone (private module) — Go: fatal: could not read Username for 'https://github.com': terminal prompts disabled (Go)terminal prompts disa…TF401019 — TF401019: The Git repository with name or identifier x does not exist or you do not have permissions for the operation (Azure)TF401019The process '/usr/bin/git' failed with exit code 128 — GitHub Actions: Error: The process '/usr/bin/git' failed with exit code 128 (CI/CD)The process '/usr/bin…Failed to…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.