hashicorp/terraform · error
no schema found for (in provider )
Error message
no schema found for %s (in provider %s)
What it means
Thrown by jsonstate after the schema-version check passes but schema.Body is still nil. schemas.ResourceTypeConfig returned a version number for the resource type yet no actual schema body, so the decoder cannot proceed. The message includes the provider address to disambiguate which provider is missing the definition.
Solutions
- Run `terraform init -upgrade` to rebuild the provider schema cache from scratch.
- Pin a provider version that still defines the resource type, or remove the obsolete resource from state with `terraform state rm`.
- Inspect provider output/logs for schema retrieval errors.
- If migrating providers, use `terraform state replace-provider` to remap the resource to a provider that defines it.
Example fix
# obsolete resource left in state after provider upgrade terraform state rm azurerm_old_resource.x # or remap to a provider that still defines it terraform state replace-provider registry.terraform.io/hashicorp/azurerm registry.terraform.io/hashicorp/azurerm
Defensive patterns
Strategy: validation
Validate before calling
schema := schemas.ResourceTypeConfig(r.ProviderConfig.Provider, resAddr.Mode, resAddr.Type)
if schema.Body == nil {
return fmt.Errorf("provider %s exposes version %d for %s but no schema body; run 'terraform init -upgrade'", r.ProviderConfig.Provider, schema.Version, resAddr)
} Prevention
- Run `terraform init -upgrade` after switching provider source or version to rebuild the schema cache.
- Remove obsolete resources from state with `terraform state rm` after a provider major-version change.
- Use `terraform state replace-provider` when migrating between providers that define the same type.
When it happens
Trigger: The provider exposes a version entry for the type but no schema (partial/corrupt schema load); the resource type was removed in the configured provider version but a version record lingers; stale provider schema cache from a previous, broken init.
Common situations: Provider major version removed/renamed the resource type while it remains in state; provider plugin crashed mid-schema and cached an incomplete schema; switching provider source (e.g. hashicorp/aws vs a fork) whose type catalogs differ.
Related errors
- no resource identity schema found for
- action schema not found for action
- Failed to marshal state to json
- Failed to set state store provider configuration
- identity schema not found for type
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/e294f9415e641b46.
Report an issue: GitHub.
Appendix: source
Thrown at internal/command/jsonstate/state.go:427
)
}
schema := schemas.ResourceTypeConfig(
r.ProviderConfig.Provider,
resAddr.Mode,
resAddr.Type,
)
// It is possible that the only instance is deposed
if ri.Current != nil {
if schema.Version != int64(ri.Current.SchemaVersion) {
return nil, fmt.Errorf("schema version %d for %s in state does not match version %d from the provider", ri.Current.SchemaVersion, resAddr, schema.Version)
}
current.SchemaVersion = ri.Current.SchemaVersion
if schema.Body == nil {
return nil, fmt.Errorf("no schema found for %s (in provider %s)", resAddr.String(), r.ProviderConfig.Provider)
}
// Check if we have an identity in the state
if ri.Current.IdentityJSON != nil {
if schema.IdentityVersion != int64(ri.Current.IdentitySchemaVersion) {
return nil, fmt.Errorf("resource identity schema version %d for %s in state does not match version %d from the provider", ri.Current.IdentitySchemaVersion, resAddr, schema.IdentityVersion)
}
if schema.Identity == nil {
return nil, fmt.Errorf("no resource identity schema found for %s (in provider %s)", resAddr.String(), r.ProviderConfig.Provider)
}
current.IdentitySchemaVersion = &ri.Current.IdentitySchemaVersion
}
riObj, err := ri.Current.Decode(schema)
if err != nil {
return nil, errView on GitHub (pinned to d32a084675)