pulumi/pulumi · error

could not find latest version for provider %s: %w

Error message

could not find latest version for provider %s: %w

What it means

Thrown by downloadPlugin when a plugin spec has no pinned version and pluginstorage.Instance.GetLatestVersion cannot resolve the latest version from the plugin registry/metadata service. It means Pulumi could not determine which version of the provider to download. The wrapped error from GetLatestVersion carries the actual cause (network failure, unknown plugin name, registry outage).

Source

Thrown at pkg/workspace/plugin.go:103

			Spec: pluginSpec,
			Err:  fmt.Errorf("error installing provider %s: %w", pluginSpec.Name, err),
		}
	}

	return pluginSpec.Version, nil
}

// downloadPlugin resolves the plugin's version, if unset, and downloads its archive to a file,
// retrying and logging progress along the way.
func downloadPlugin(
	ctx context.Context, pluginSpec *workspace.PluginDescriptor, log func(sev diag.Severity, msg string),
) (*os.File, error) {
	util.SetKnownPluginDownloadURL(pluginSpec)
	if pluginSpec.Version == nil {
		var err error
		pluginSpec.Version, err = pluginstorage.Instance.GetLatestVersion(ctx, *pluginSpec)
		if err != nil {
			return nil, fmt.Errorf("could not find latest version for provider %s: %w", pluginSpec.Name, err)
		}
	}

	wrapper := func(stream io.ReadCloser, size int64) io.ReadCloser {
		// Log at info but to stderr so we don't pollute stdout for commands like `package get-schema`
		log(diag.Infoerr, "Downloading provider: "+pluginSpec.Name)
		return stream
	}

	retry := func(err error, attempt int, limit int, delay time.Duration) {
		log(diag.Warning, fmt.Sprintf("error downloading provider: %s\n"+
			"Will retry in %v [%d/%d]", err, delay, attempt, limit))
	}

	logging.V(1).Infof("Automatically downloading provider %s", pluginSpec.Name)
	downloadedFile, err := workspace.DownloadToFile(ctx, *pluginSpec, wrapper, retry)
	if err != nil {
		return nil, &InstallPluginError{

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Pin an explicit plugin version in the project's Pulumi.yaml `plugins:` block (or use the provider SDK's pinned version) so latest-version lookup is skipped.
  2. Check network access to the plugin registry (api.pulumi.com) and any proxy settings (HTTPS_PROXY).
  3. Verify the plugin name spelling and that it exists with `pulumi plugin ls` or on the Pulumi registry.
  4. Set `plugins: providers: - name: x version: vX.Y.Z` plus a custom `pluginDownloadURL` for private providers.

Example fix

// before: name: pulumi-awssdk with no version -> latest lookup
plugins:
  providers:
    - name: awssdk
// after: pin the version so no latest lookup is needed
plugins:
  providers:
    - name: awssdk
      version: 1.2.0
Defensive patterns

Strategy: validation

Validate before calling

// Pin the version so the latest-version lookup is skipped
if spec.Version == nil {
    return errors.New("pin an explicit plugin version in Pulumi.yaml plugins: block to avoid registry lookup")
}

Try / catch

if err != nil {
    var ipe *workspace.InstallPluginError
    if errors.As(err, &ipe) && strings.Contains(err.Error(), "could not find latest version") {
        // retry with explicit version or check registry/network
    }
    return err
}

Prevention

When it happens

Trigger: Calling downloadPlugin/InstallPlugin with pluginSpec.Version == nil while the version-resolution API call fails — e.g. no network access, the plugin name does not exist in the registry, the registry returns 404/5xx, or a custom PluginDownloadURL lacks version metadata.

Common situations: Offline/air-gapped environments or corporate proxies blocking api.pulumi.com; typo in a third-party provider name; private providers whose download URL metadata isn't published; registry outages.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/417b10ed26d1d8ae. Report an issue: GitHub.