hashicorp/terraform · error

no schema found for

Error message

no schema found for %s

What it means

Thrown by jsonplan when schemas.ResourceTypeConfig returns a schema whose Body is nil for the resource being planned. A nil body means the loaded provider schema has no definition for that resource type (mode+type+provider), so Terraform cannot decode/transcode the planned value to JSON.

Solutions

  1. Run `terraform init` to (re)download the provider and rebuild the schema cache.
  2. Verify the resource type spelling and the provider source/version in required_providers.
  3. Check provider logs/output for schema-load errors and resolve them.
  4. Pin a provider version known to define the resource type, then `terraform init -upgrade`.

Example fix

# before
resource "aws_instance" "x" { ... }   # typo or undefined type

# after
resource "aws_instance" "web" { ... }  # correct type after terraform init
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the provider schema actually defines the resource type before marshaling.
schema := schemas.ResourceTypeConfig(provider, mode, resourceType)
if schema.Body == nil {
    return fmt.Errorf("provider %s has no schema for %s; run 'terraform init' and check the resource type", provider, resourceType)
}

Prevention

When it happens

Trigger: The resource type in the configuration is not declared by the provider's schema; the provider partially failed to load and produced an incomplete schema; the wrong provider source/version is configured.

Common situations: Typo in the resource type name; `terraform init` not run or run against the wrong provider; provider version too old to define the type, or so new the type was removed/renamed; provider plugin error during schema retrieval that left a partial schema.

Related errors


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

Appendix: 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 d32a084675)