hashicorp/terraform · error
no schema found for %s
Error message
no schema found for %s
What it means
Thrown by the JSON plan values builder when the provider schema lookup (schemas.ResourceTypeConfig) returns a schema whose Body is nil for a resource type present in the planned changes. This means the provider advertising the resource type is loaded but does not actually define that resource type's schema, so the change cannot be decoded.
Source
Thrown at internal/command/jsonplan/values.go:203
switch r.Addr.Resource.Resource.Mode {
case addrs.ManagedResourceMode:
resource.Mode = "managed"
case addrs.DataResourceMode:
resource.Mode = "data"
default:
return nil, fmt.Errorf("resource %s has an unsupported mode %s",
r.Addr.String(),
r.Addr.Resource.Resource.Mode.String(),
)
}
schema := schemas.ResourceTypeConfig(
r.ProviderAddr.Provider,
r.Addr.Resource.Resource.Mode,
resource.Type,
)
if schema.Body == nil {
return nil, fmt.Errorf("no schema found for %s", r.Addr.String())
}
resource.SchemaVersion = uint64(schema.Version)
changeV, err := r.Decode(schema)
if err != nil {
return nil, err
}
// copy the marked After values so we can use these in marshalSensitiveValues
markedAfter := changeV.After
// The values may be marked, but we must rely on the Sensitive flag
// as the decoded value is only an intermediate step in transcoding
// this to a json format.
changeV.Before, _ = changeV.Before.UnmarkDeep()
changeV.After, _ = changeV.After.UnmarkDeep()
if changeV.After != cty.NilVal {
if changeV.After.IsWhollyKnown() {View on GitHub (pinned to c9def3e214)
Solutions
- Verify the resource type name is spelled correctly and exists in your provider version (check the provider's docs/changelog).
- Upgrade the provider: `terraform init -upgrade` or bump the version in required_providers to one that defines the resource.
- Run `terraform providers schema -json` and confirm the resource type appears under the expected provider.
- Check for aliased providers (`provider "aws" { alias = ... }`) and ensure the resource's provider meta-argument points to a provider that has the type.
Example fix
// before: provider version lacks the resource type
terraform {
required_providers {
aws = { source = "hashicorp/aws", version = "~> 3.0" }
}
}
// after: bump to a version that defines the resource
terraform {
required_providers {
aws = { source = "hashicorp/aws", version = "~> 5.0" }
}
} Defensive patterns
Strategy: validation
Validate before calling
// Before rendering the plan as JSON, ensure every resource type has a provider schema.
schemas, _ := config.SchemasForProviders(config.ProviderRequirements())
for _, r := range plannedChanges {
s := schemas.ResourceTypeConfig(r.ProviderAddr.Provider, r.Addr.Resource.Resource.Mode, r.Addr.Resource.Resource.Type)
if s.Body == nil {
return fmt.Errorf("config references %q but the provider has no schema for it", r.Addr.Resource.Resource.Type)
}
} Try / catch
if _, err := jsonplan.MarshalValues(changes, schemas); err != nil {
// Most common cause: missing provider schema — guide user to fix required_providers.
return err
} Prevention
- Run `terraform providers schema -json` in CI to assert all referenced resource types are defined.
- Pin required_providers versions explicitly and run `terraform init` before plan.
- Add a check that fails CI if a config references a resource type absent from the provider schema.
When it happens
Trigger: Occurs during JSON plan rendering when a planned change references a resource type (e.g. aws_instance) whose schema.Body is nil after provider schema lookup. Triggered by `terraform show -json <plan>` or `terraform plan -json` when the resource type is absent from the loaded provider's schema.
Common situations: Happens when the provider version in the lock file / required_providers does not define the resource type the config uses (e.g. resource renamed/removed in a provider downgrade), when a provider failed to fully initialize, or when using an aliased/wrong provider. Also seen after a `terraform state replace-provider` with incompatible versions.
Related errors
- Remote workspace Terraform version %q does not match local T
- no schema found for %s (in provider %s)
- no resource identity schema found for %s (in provider %s)
- default workspace not supported You can create a new workspa
- missing provider schema
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/5953ce0501d80f6f.
Report an issue: GitHub.