hashicorp/terraform · error

resource schema not found for type

Error message

resource schema not found for type %q

What it means

Returned by the tfplugin5 ListResource handler when the requested resource type is not registered in the provider's schema map (p.schema.ResourceTypes). Terraform core asked the provider to list instances of a type the provider never advertised, so the wrapper has no schema to decode the config against and aborts before calling the inner provider.

Solutions

  1. Run `terraform providers schema -json` and confirm the type is advertised by the active provider version.
  2. Correct the resource type spelling in the configuration to match the provider exactly.
  3. Upgrade (or pin) the provider to the version that registers the resource type.
  4. If developing a built-in provider exposed via grpcwrap, add the type to the schema.ResourceTypes map returned by GetProviderSchema.

Example fix

// before: resource type never registered
providerSchema.ResourceTypes = map[string]*config.Block{}
// after
providerSchema.ResourceTypes = map[string]*config.Block{
    "aws_example_thing": exampleResourceSchema,
}
Defensive patterns

Strategy: validation

Validate before calling

// Before issuing a ListResource RPC, confirm the type is registered.
schemas, err := client.GetProviderSchema(ctx, &tfplugin5.GetProviderSchema_Request{})
if err != nil {
    return err
}
if _, ok := schemas.ResourceTypes[typeName]; !ok {
    return fmt.Errorf("will not call ListResource: type %q not registered by provider", typeName)
}
return client.ListResource(ctx, typeName, config)

Type guard

// Guard that the provider schema actually contains the resource type.
func resourceTypeRegistered(s *tfplugin5.GetProviderSchema_Response, typeName string) bool {
    _, ok := s.ResourceTypes[typeName]
    return ok
}

Prevention

When it happens

Trigger: A ListResource RPC arrives whose req.TypeName is absent from p.schema.ResourceTypes; the map lookup returns ok=false and the handler returns this error immediately.

Common situations: Provider version that does not contain the resource; typo'd resource type in HCL; terraform core built against a newer schema than the running provider; a built-in/internal provider that forgot to register the type in schema.ResourceTypes.

Related errors


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

Appendix: source

Thrown at internal/grpcwrap/provider.go:787

	if upgradeResp.Diagnostics.HasErrors() {
		return resp, nil
	}

	dv, err := encodeDynamicValue(upgradeResp.UpgradedIdentity, ty)
	if err != nil {
		resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
		return resp, nil
	}
	resp.UpgradedIdentity = &tfplugin5.ResourceIdentityData{
		IdentityData: dv,
	}
	return resp, nil
}

func (p *provider) ListResource(req *tfplugin5.ListResource_Request, res tfplugin5.Provider_ListResourceServer) error {
	resourceSchema, ok := p.schema.ResourceTypes[req.TypeName]
	if !ok {
		return fmt.Errorf("resource schema not found for type %q", req.TypeName)
	}
	listSchema, ok := p.schema.ListResourceTypes[req.TypeName]
	if !ok {
		return fmt.Errorf("list resource schema not found for type %q", req.TypeName)
	}
	cfg, err := decodeDynamicValue(req.Config, listSchema.Body.ImpliedType())
	if err != nil {
		return status.Errorf(codes.InvalidArgument, "failed to decode config: %v", err)
	}
	resp := p.provider.ListResource(providers.ListResourceRequest{
		TypeName:              req.TypeName,
		Config:                cfg,
		Limit:                 req.Limit,
		IncludeResourceObject: req.IncludeResourceObject,
	})
	if resp.Diagnostics.HasErrors() {
		return resp.Diagnostics.Err()
	}

View on GitHub (pinned to d32a084675)