hashicorp/terraform · error

provider mirror does not have archive index for…

Error message

provider mirror does not have archive index for previously-reported %s version %s

What it means

In the package-meta fetch path, a 404 on a specific version that was previously advertised in the version index is treated as a protocol error: the mirror told us a version exists but then cannot serve its archive index. The error names the provider and version to make the inconsistency explicit.

Solutions

  1. Retry `terraform init` (the mirror may have finished syncing).
  2. Re-sync or rebuild the mirror so the version list and per-version indexes agree.
  3. Invalidate CDN caches for the mirror.
  4. Pin the provider version to one that is consistently available on the mirror.

Example fix

// before: stale CDN returns 404 for a listed version
$ terraform init -> provider mirror does not have archive index ... version 4.50.0
// after: flush cache and re-init
$ mirror-cdn purge /hashicorp/aws/4.50.0/index.json
$ terraform init
Defensive patterns

Strategy: retry

Validate before calling

// Verify the version still exists right before requesting detail
versions, err := s.AvailableVersions(ctx, provider)
if err != nil { return err }
if _, ok := versions.Find(version); !ok {
    return ErrProviderVersionNotFound{Provider: provider, Version: version}
}

Try / catch

// Retry once: the index may be repopulating
err := retryDo(ctx, 2, backoff, func() error {
    _, e := s.PackageMeta(ctx, provider, version, target)
    return e
})

Prevention

When it happens

Trigger: `PackageMeta` GET for a previously listed `<provider>/<version>/index.json` returns `http.StatusNotFound`; error at http_mirror_source.go:194.

Common situations: Mirror index was regenerated/changed between the version-list request and the version-detail request; partial mirror sync; CDN cache desync where list is fresh but detail is stale; concurrent mirror update removing a version.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/8b1c7e4c75f6acdc. Report an issue: GitHub.

Appendix: source

Thrown at internal/getproviders/http_mirror_source.go:194

	)

	statusCode, body, finalURL, err := s.get(ctx, endpointPath)
	defer func() {
		if body != nil {
			body.Close()
		}
	}()
	if err != nil {
		return PackageMeta{}, s.errQueryFailed(provider, err)
	}

	switch statusCode {
	case http.StatusOK:
		// Great!
	case http.StatusNotFound:
		// A 404 Not Found for a version we previously saw in index.json is
		// a protocol error, so we'll report this as "query failed.
		return PackageMeta{}, s.errQueryFailed(provider, fmt.Errorf("provider mirror does not have archive index for previously-reported %s version %s", provider, version))
	case http.StatusUnauthorized, http.StatusForbidden:
		return PackageMeta{}, s.errUnauthorized(finalURL)
	default:
		return PackageMeta{}, s.errQueryFailed(provider, fmt.Errorf("server returned unsuccessful status %d", statusCode))
	}

	// If we got here then the response had status OK and so our body
	// will be non-nil and should contain some JSON for us to parse.
	var bodyContent ListInstallationPackagesResponseBody

	dec := json.NewDecoder(body)
	if err := dec.Decode(&bodyContent); err != nil {
		return PackageMeta{}, s.errQueryFailed(provider, fmt.Errorf("invalid response content from mirror server: %s", err))
	}

	archiveMeta, ok := bodyContent.Archives[target.String()]
	if !ok {
		return PackageMeta{}, ErrPlatformNotSupported{

View on GitHub (pinned to d32a084675)