hashicorp/terraform · error

missing provider schema

Error message

missing provider schema

What it means

Thrown in GRPCProvider.GetSchema when the provider's GetProviderSchema gRPC response succeeds but protoResp.Provider is nil, i.e. the provider returned a schema response with no top-level provider block. Terraform cannot operate without a provider schema, so it fails.

Source

Thrown at internal/plugin/grpc_provider.go:134

	// Note: this option is marked as EXPERIMENTAL in the grpc API. We keep
	// this for compatibility, but recent providers all set the max message
	// size much higher on the server side, which is the supported method for
	// determining payload size.
	const maxRecvSize = 64 << 20
	protoResp, err := p.client.GetSchema(p.ctx, new(proto.GetProviderSchema_Request), grpc.MaxRecvMsgSizeCallOption{MaxRecvMsgSize: maxRecvSize})
	if err != nil {
		resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err))
		return resp
	}

	resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics))

	if resp.Diagnostics.HasErrors() {
		return resp
	}

	if protoResp.Provider == nil {
		resp.Diagnostics = resp.Diagnostics.Append(errors.New("missing provider schema"))
		return resp
	}

	identResp, err := p.client.GetResourceIdentitySchemas(p.ctx, new(proto.GetResourceIdentitySchemas_Request))
	if err != nil {
		if status.Code(err) == codes.Unimplemented {
			// We don't treat this as an error if older providers don't implement this method,
			// so we create an empty map for identity schemas
			identResp = &proto.GetResourceIdentitySchemas_Response{
				IdentitySchemas: map[string]*proto.ResourceIdentitySchema{},
			}
		} else {
			resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err))
			return resp
		}
	}

	resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(identResp.Diagnostics))

View on GitHub (pinned to c9def3e214)

Solutions

  1. Upgrade the provider to a release that correctly returns its provider schema.
  2. Upgrade Terraform/OpenTofu to a version whose plugin protocol matches the provider.
  3. For custom providers, ensure GetProviderSchema populates the Provider (provider block) schema field.
  4. Rebuild/reinstall the provider plugin cleanly and clear the plugin cache.

Example fix

# For a custom provider (Go, terraform-plugin-framework):
# before: provider schema field left nil
# after:
func (p *provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {
    resp.Schema = provider.Schema{
        Attributes: map[string]schema.Attribute{
            "region": schema.StringAttribute{Optional: true},
        },
    }
}
# pin a known-good provider in config:
required_providers { myp = { source = "acme/myp", version = "0.5.0" } }
Defensive patterns

Strategy: validation

Validate before calling

# pin a provider known to ship a provider schema and assert compatibility
check "provider_compat" {
  assert {
    condition     = !contains(data.tfe_outputs.bad.references, "nil-schema")
    error_message = "provider returned no provider schema; upgrade provider"
  }
}

Try / catch

# fall back to a pinned version in CI while investigating
# terraform init -upgrade=false ; with required_providers version = "=X.Y.Z"

Prevention

When it happens

Trigger: A provider plugin (often a hand-rolled or in-development one) whose GetProviderSchema implementation omits the Provider field; a provider built against a mismatched plugin SDK/framework version; a stub returning an empty response.

Common situations: Authoring/testing a custom provider that hasn't implemented GetProviderSchema fully; protocol-version skew between Terraform and the provider; a corrupted or half-built provider binary.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/f2945a80c770096d. Report an issue: GitHub.