hashicorp/terraform · error

no schema found for (in provider )

Error message

no schema found for %s (in provider %s)

What it means

Returned by marshalResourceChange: schemas.ResourceTypeConfig returned a schema whose Body is nil, meaning the provider does not advertise the resource type (in the given mode) that the plan change references. The resource change cannot be decoded without a schema.

Solutions

  1. Run `terraform init -upgrade` to fetch a provider version that defines the resource type.
  2. Verify the provider version in .terraform.lock.hcl supports the resource type named in the error.
  3. Regenerate the plan with the current provider set.
  4. If the resource type was intentionally removed, remove it from config and state before re-planning.
Defensive patterns

Strategy: validation

Validate before calling

// Check the resource type schema is present for a change before marshaling.
func resourceSchemaOk(schemas *terraform.Schemas, provider addrs.Provider, mode addrs.ResourceMode, typ string) bool {
    s := schemas.ResourceTypeConfig(provider, mode, typ)
    return s.Body != nil
}

Prevention

When it happens

Trigger: Provider plugin version that does not define the resource type; provider not initialized; stale plugin cache; managed-resource vs data-source mode mismatch in the address.

Common situations: Provider downgrade that removed a resource type; CI locked to an older provider; resource renamed/removed upstream; state referencing a type the current provider no longer ships.

Related errors


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

Appendix: source

Thrown at internal/command/jsonplan/plan.go:462

	return ret, nil
}

func marshalResourceChange(rc *plans.ResourceInstanceChangeSrc, schemas *terraform.Schemas) (ResourceChange, error) {
	var r ResourceChange
	addr := rc.Addr
	r.Address = addr.String()
	if !addr.Equal(rc.PrevRunAddr) {
		r.PreviousAddress = rc.PrevRunAddr.String()
	}

	schema := schemas.ResourceTypeConfig(
		rc.ProviderAddr.Provider,
		addr.Resource.Resource.Mode,
		addr.Resource.Resource.Type,
	)
	if schema.Body == nil {
		return r, fmt.Errorf("no schema found for %s (in provider %s)", r.Address, rc.ProviderAddr.Provider)
	}

	changeV, err := rc.Decode(schema)
	if err != nil {
		return r, err
	}
	// We drop the marks from the change, as decoding is only an
	// intermediate step to re-encode the values as json
	changeV.Before, _ = changeV.Before.UnmarkDeep()
	changeV.After, _ = changeV.After.UnmarkDeep()

	var before, after []byte
	var beforeSensitive, afterSensitive []byte
	var afterUnknown cty.Value

	if changeV.Before != cty.NilVal {
		before, err = ctyjson.Marshal(changeV.Before, changeV.Before.Type())
		if err != nil {

View on GitHub (pinned to d32a084675)