weaviate/weaviate · error

ErrMTDisabled

ErrMTDisabled

Error message

multi-tenancy disabled for class %q (wrapped with ErrMTDisabled)

What it means

The internal multiTenancyEnabled check refuses tenant operations (addTenants, deleteTenants, updateTenants, updateTenantsProcess, getTenants) when the class's ClassInfo.MultiTenancy.Enabled is false. Tenant management APIs are only valid on multi-tenant collections; the error wraps ErrMTDisabled so callers can errors.Is-match it.

Source

Thrown at cluster/schema/schema.go:372

func (s *schema) len() int {
	s.mu.RLock()
	defer s.mu.RUnlock()

	return len(s.classes)
}

func (s *schema) multiTenancyEnabled(class string) (bool, *metaClass, ClassInfo, error) {
	s.mu.RLock()
	defer s.mu.RUnlock()

	meta := s.unsafeResolveClass(class)
	if meta == nil {
		return false, nil, ClassInfo{}, ErrClassNotFound
	}
	info := s.unsafeResolveClass(class).ClassInfo()
	if !info.MultiTenancy.Enabled {
		return false, nil, ClassInfo{}, fmt.Errorf("%w for class %q", ErrMTDisabled, class)
	}
	return true, meta, info, nil
}

func (s *schema) addClass(cls *models.Class, ss *sharding.State, v uint64) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	_, exists := s.classes[cls.Class]
	if exists {
		return ErrClassExists
	}

	s.classes[cls.Class] = &metaClass{
		Class: *cls, Sharding: *ss, ClassVersion: v, ShardVersion: v,
	}

	ns := namespacing.NamespaceFromQualified(cls.Class)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Enable multi-tenancy by recreating the class with {"multiTenancy": {"enabled": true}} (cannot be toggled on an existing class)
  2. Point the tenant API calls at the correct multi-tenant collection name
  3. For single-tenant collections, store data as plain objects instead of tenants
  4. Update automation/client code to check MultiTenancy.Enabled via the schema before calling tenant endpoints

Example fix

// before
client.Schema().ClassCreator().WithClass(&models.Class{Class: "Docs"}).Do() // MT off
client.Data().TenantsCreator().WithClass("Docs").WithTenants(...).Do() // ErrMTDisabled
// after
client.Schema().ClassCreator().WithClass(&models.Class{Class: "Docs", MultiTenancy: &models.MultiTenancyConfig{Enabled: true}}).Do()
Defensive patterns

Strategy: validation

Validate before calling

cls, err := client.Schema().ClassGetter().WithClassName(class).Do(ctx)
if err != nil { return err }
if cls.Class == nil || cls.Class.MultiTenancy == nil || !cls.Class.MultiTenancy.Enabled { return ErrMTDisabled }

Type guard

func multiTenancyEnabled(c *models.Class) bool {
  return c != nil && c.MultiTenancy != nil && c.MultiTenancy.Enabled
}

Try / catch

if errors.Is(err, schema.ErrMTDisabled) { recreateClassWithMTEnabled() }

Prevention

When it happens

Trigger: Calling any tenant API (add/update/delete/get tenants, tenant process) against a class created without multi-tenancy enabled in its class definition.

Common situations: Reusing a single-tenant collection created earlier and later attempting to add tenants; migrating tooling from non-MT to MT collections without recreating them; copy-pasted client code pointing at the wrong class name.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/4ec613a37b38a70f. Report an issue: GitHub.