How do I fix "Failed to load plugin schemas" for registry.terraform.io providers on OpenTofu?
Last updated: November 25, 2026
After you move a stack from Terraform to OpenTofu 1.10 or later, or upgrade an existing OpenTofu stack to 1.10 or later, runs can log this error after the plan:
Error: Failed to load plugin schemas
Error while loading schemas for plugin components: Failed to obtain
provider schema: Could not load the schema for provider
registry.terraform.io/hashicorp/aws: failed to instantiate provider
"registry.terraform.io/hashicorp/aws" to obtain schema: unavailable
provider "registry.terraform.io/hashicorp/aws"..It's followed by unexpected exit code when running show command: 1. The wording varies slightly between OpenTofu versions, but it always names a provider on registry.terraform.io as unavailable.
Why it happens
Terraform saves each resource's provider in state with its full address, for example registry.terraform.io/hashicorp/aws. When your code uses a short source such as hashicorp/aws, OpenTofu installs the provider from registry.opentofu.org.
From OpenTofu 1.10, tofu show doesn't translate the old addresses, and Spacelift uses it to read your state. So it looks for a provider that isn't installed.
The run still completes, but Spacelift can't show the resource changes for it. The error repeats on every run until OpenTofu writes the state, for example in a run that applies changes. Runs with no changes don't write state.
Fix: let OpenTofu rewrite the state
Run this as a task on each affected stack, then trigger a run to check that the error is gone:
tofu apply -refresh-only -auto-approveThis refreshes every resource and saves the state with the new provider addresses. If anything changed outside OpenTofu, those changes are also saved to state without review.
To update only the provider addresses, without refreshing any resources, run this task instead:
for p in $(tofu state pull | grep -o 'registry\.terraform\.io/[^\\"]*' | sort -u); do tofu state replace-provider -auto-approve $p ${p#*/}; doneThe task logs the original error before it runs, and may log these messages afterwards. You can ignore all of them:
This run has succeeded however entity changes for this run will not visible in the UI ...
Could not read pre-apply state: EOF: decoding state failed
Skipping uploading state analytics due to error: user workflow failureProvider sources with registry.terraform.io
Changing source doesn't update state. If you remove registry.terraform.io/ from a source, this error appears until you run the task above. OpenTofu doesn't recommend using that hostname, so to stop using it, change the source to the short form, for example hashicorp/aws, then run the task.
If tofu init warns OpenTofu has detected multiple providers of type ..., your sources and your state usually use different registries. Switch the sources to the short form and run the task, so both use registry.opentofu.org.
The lock file isn't the cause of this error, so you don't need to delete .terraform.lock.hcl.