Skip to content
Latchkey

OpenTofu "Invalid provider registry host" in CI

A provider source address in your configuration names a registry host that OpenTofu could not use, either because the host does not implement the provider registry protocol or the address is malformed after migration.

What this error means

tofu init fails with "Error: Invalid provider registry host" naming the source address, for example "the host \"registry.terraform.io\" given in provider source address ... does not offer a OpenTofu provider registry".

tofu
Error: Invalid provider registry host

The host "terraform.example.com" given in provider source address
"terraform.example.com/hashicorp/aws" does not offer a OpenTofu provider
registry that is compatible with this OpenTofu version.

Common causes

A source address points at a non-registry host

The source names a hostname that does not serve the provider registry discovery protocol, so tofu cannot resolve providers from it.

A leftover Terraform-registry source after migration

A hardcoded registry.terraform.io/... source may not resolve the same way under OpenTofu; prefer the default namespace or the OpenTofu registry host.

How to fix it

Use the default source or a valid registry host

  1. Drop the explicit host and use the short namespace/name form so tofu uses its default registry.
  2. If you must name a host, ensure it serves the OpenTofu provider registry protocol.
  3. Re-run tofu init to confirm the source resolves.
versions.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

Configure a provider mirror instead of a raw host

To serve providers internally, set up a filesystem or network mirror and point tofu at it via CLI config rather than a bare source host.

.tofurc
provider_installation {
  network_mirror {
    url = "https://tofu-mirror.example.com/providers/"
  }
}

How to prevent it

  • Prefer short namespace/name provider sources over hardcoded hosts.
  • Use a proper provider mirror for internal distribution.
  • Recheck provider sources when migrating from Terraform.

Related guides

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