opentofu/opentofu · error

missing provider schema

Error message

missing provider schema

What it means

Returned by GRPCProvider.GetSchema in internal/plugin/grpc_provider.go when the provider process answered the GetSchema RPC without transport errors and without error diagnostics, but its response message had no Provider field. That is a protocol-5 plugin that violated the tfplugin contract: a schema response must always carry a provider schema.

Source

Thrown at internal/plugin/grpc_provider.go:131

	resp.ResourceTypes = make(map[string]providers.Schema)
	resp.DataSources = make(map[string]providers.Schema)
	resp.EphemeralResources = make(map[string]providers.Schema)
	resp.Functions = make(map[string]providers.FunctionSpec)

	protoResp, err := p.getProtoProviderSchema(ctx)
	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
	}

	// We want to allow "provider" blocks to work with ephemeral variables, so we
	// just mark its schema as able to get such values.
	resp.Provider = convert.ProtoToEphemeralProviderSchema(protoResp.Provider)
	if protoResp.ProviderMeta == nil {
		logger.Debug("No provider meta schema returned")
	} else {
		resp.ProviderMeta = convert.ProtoToProviderSchema(protoResp.ProviderMeta)
	}

	for name, res := range protoResp.ResourceSchemas {
		resp.ResourceTypes[name] = convert.ProtoToProviderSchema(res)
	}

	for name, data := range protoResp.DataSourceSchemas {
		resp.DataSources[name] = convert.ProtoToProviderSchema(data)

View on GitHub (pinned to 3561785c48)

Solutions

  1. Rebuild the provider with an established framework (terraform-plugin-framework or terraform-plugin-sdk) which always populates the Provider schema.
  2. Verify the plugin's protocol version matches what the client negotiated (protocol 5 for this file).
  3. Capture the raw gRPC response with a proxy or debug logging to confirm the field is truly absent.
  4. Report the contract violation to the plugin maintainers with the plugin version and SDK used.
Defensive patterns

Strategy: try-catch

Try / catch

resp := provider.GetSchema()
if resp.Diagnostics.HasErrors() {
	for _, d := range resp.Diagnostics {
		if strings.Contains(d.Description().Summary, "missing provider schema") {
			// plugin violated the protocol: restart it, then rebuild/re-verify before retrying once
		}
	}
	return resp.Diagnostics
}

Prevention

When it happens

Trigger: Embedding OpenTofu and calling GRPCProvider.GetSchema() on a misbehaving or hand-rolled plugin; a plugin built with an incomplete SDK whose GetSchema returns an empty message; rarely, a version-skew where the server serializes the field in a way the client proto cannot see.

Common situations: Custom in-house providers written directly against the gRPC protocol instead of a framework; early/experimental protocol implementations; plugin binary truncated or built from mismatched proto definitions; test double/fake providers that stub GetSchema.

Related errors


AI-assisted analysis of opentofu/opentofu@3561785c48 (2026-08-15). Data as JSON: /api/errors/6827dc9c70cf39aa. Report an issue: GitHub.