{"record":{"id":"f2945a80c770096d","repo":"hashicorp/terraform","slug":"missing-provider-schema","errorCode":null,"errorMessage":"missing provider schema","messagePattern":"missing provider schema","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/plugin/grpc_provider.go","lineNumber":134,"sourceCode":"\t// Note: this option is marked as EXPERIMENTAL in the grpc API. We keep\n\t// this for compatibility, but recent providers all set the max message\n\t// size much higher on the server side, which is the supported method for\n\t// determining payload size.\n\tconst maxRecvSize = 64 << 20\n\tprotoResp, err := p.client.GetSchema(p.ctx, new(proto.GetProviderSchema_Request), grpc.MaxRecvMsgSizeCallOption{MaxRecvMsgSize: maxRecvSize})\n\tif err != nil {\n\t\tresp.Diagnostics = resp.Diagnostics.Append(grpcErr(err))\n\t\treturn resp\n\t}\n\n\tresp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics))\n\n\tif resp.Diagnostics.HasErrors() {\n\t\treturn resp\n\t}\n\n\tif protoResp.Provider == nil {\n\t\tresp.Diagnostics = resp.Diagnostics.Append(errors.New(\"missing provider schema\"))\n\t\treturn resp\n\t}\n\n\tidentResp, err := p.client.GetResourceIdentitySchemas(p.ctx, new(proto.GetResourceIdentitySchemas_Request))\n\tif err != nil {\n\t\tif status.Code(err) == codes.Unimplemented {\n\t\t\t// We don't treat this as an error if older providers don't implement this method,\n\t\t\t// so we create an empty map for identity schemas\n\t\t\tidentResp = &proto.GetResourceIdentitySchemas_Response{\n\t\t\t\tIdentitySchemas: map[string]*proto.ResourceIdentitySchema{},\n\t\t\t}\n\t\t} else {\n\t\t\tresp.Diagnostics = resp.Diagnostics.Append(grpcErr(err))\n\t\t\treturn resp\n\t\t}\n\t}\n\n\tresp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(identResp.Diagnostics))","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/plugin/grpc_provider.go#L116-L152","documentation":"Thrown by the Terraform plugin v5 gRPC client (GRPCProvider.GetProviderSchema) when the provider's GetProviderSchema RPC succeeded and returned no diagnostics, but the `Provider` field of the response is nil. Terraform requires every provider to declare a top-level provider schema block; a nil provider schema means the provider binary is non-conformant or broken. This is a server-side (provider) defect surfaced to the core.","triggerScenarios":"A provider plugin's GetProviderSchema handler returned a response with Provider == nil and no error. Typically a mis-built provider, a protocol-version mismatch, or a provider crash that produced an empty response.","commonSituations":"Using a provider built against an old/new SDK that omits the provider block. A provider binary that crashed mid-handshake. A corrupted provider cache. Version skew between Terraform core and the provider.","solutions":["Upgrade the provider to a version compatible with this Terraform core (`terraform providers lock` / `terraform init -upgrade`).","Clear the plugin cache and re-init: remove .terraform/providers and run terraform init.","Try the v6 protocol equivalent of the provider, or pin a known-good provider version.","If you maintain the provider, ensure GetProviderSchema always returns a non-nil Provider block."],"exampleFix":"# before: provider v5 returning empty schema\n# (provider-side fix; in Go provider code, set resp.Provider in GetProviderSchema)\n\n# terraform user-side fix:\n$ terraform init -upgrade","handlingStrategy":"retry","validationCode":"# shell: verify provider responds with a schema before planning\n$ terraform providers schema -json | jq '.provider_schemas | length'","typeGuard":null,"tryCatchPattern":"# bash: init with fallback to upgrade/reinstall on schema failure\nif ! terraform init 2>err.log; then\n  if grep -q 'missing provider schema' err.log; then\n    rm -rf .terraform/providers && terraform init -upgrade\n  else\n    cat err.log; exit 1\n  fi\nfi","preventionTips":["Pin provider versions in required_providers to known-good releases.","Run terraform init with -upgrade when a provider starts misbehaving.","Keep the plugin cache clean; corrupted caches surface as schema errors.","Run terraform validate in CI after every init."],"tags":["terraform","provider","grpc","plugin-v5","schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}