weaviate/weaviate · error

multi-tenancy is not enabled

Error message

multi-tenancy is not enabled

What it means

ErrMTDisabled ("multi-tenancy is not enabled") is thrown when a tenant-scoped operation is performed on a collection whose multiTenancyConfig.enabled is false. Tenant management (add/update/delete tenants) and tenant-parameterized reads/writes require MT to be enabled on the class. The RAFT RPC client (cluster/rpc/client.go) reconstructs this sentinel on remote nodes by matching the message text, so it survives cross-node calls, and the REST error mapper explicitly classifies it as NOT part of the invalid-state-transition family (no special status mapping).

Solutions

  1. Enable multi-tenancy in the class definition when creating it (multiTenancyConfig.enabled = true); it cannot be toggled on an existing class, so recreate/migrate if needed.
  2. Skip tenant operations for collections where MT is disabled (check the class schema first).
  3. Route tenant-scoped traffic only to MT-enabled collections in your data-access layer.
  4. Verify class config with GET /v1/schema/{class} and inspect multiTenancyConfig.

Example fix

// before
client.Schema().TenantsCreator().WithClassName("Legacy").WithTenants(t).Do(ctx) // MT off
// after
class, _ := client.Schema().ClassGetter().WithClassName("Legacy").Do(ctx)
if class.MultiTenancy != nil && class.MultiTenancy.Enabled {
    client.Schema().TenantsCreator().WithClassName("Legacy").WithTenants(t).Do(ctx)
}
Defensive patterns

Strategy: validation

Validate before calling

// Go: check MT is enabled before tenant ops
cls, err := client.Schema().ClassGetter().WithClassName(class).Do(ctx)
if err != nil {
    return err
}
if cls.MultiTenancy == nil || !cls.MultiTenancy.Enabled {
    return fmt.Errorf("class %q has multi-tenancy disabled; cannot manage tenants", class)
}

Type guard

// Go
func isMTDisabled(err error) bool { return errors.Is(err, schema.ErrMTDisabled) }
func mtEnabled(cls *models.Class) bool { return cls != nil && cls.MultiTenancy != nil && cls.MultiTenancy.Enabled }

Try / catch

if err != nil && errors.Is(err, schema.ErrMTDisabled) {
    return fmt.Errorf("tenant operation not applicable to non-MT class: %w", err)
}

Prevention

When it happens

Trigger: POST/PUT/DELETE /v1/schema/{class}/tenants on a non-MT class; object create/read with ?tenant= on a class without multi-tenancy; replicated tenant operations hitting a node whose schema says MT is off; enabling MT usage before migrating the class config.

Common situations: Adding tenants to a legacy collection created before MT was adopted; forgetting 'multiTenancyConfig: {enabled: true}' in the class definition; a client SDK sharing tenant logic across both MT and non-MT collections; schema drift between nodes during upgrades.

Related errors


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

Appendix: source

Thrown at cluster/schema/schema.go:41

	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promauto"

	command "github.com/weaviate/weaviate/cluster/proto/api"
	"github.com/weaviate/weaviate/cluster/types"
	"github.com/weaviate/weaviate/entities/models"
	entSchema "github.com/weaviate/weaviate/entities/schema"
	"github.com/weaviate/weaviate/entities/versioned"
	"github.com/weaviate/weaviate/usecases/schema/namespacing"
	"github.com/weaviate/weaviate/usecases/sharding"
)

var (
	ErrClassExists   = errors.New("class already exists")
	ErrClassNotFound = errors.New("class not found")
	ErrShardNotFound = errors.New("shard not found")
	ErrAliasExists   = errors.New("alias already exists")
	ErrAliasNotFound = errors.New("alias not found")
	ErrMTDisabled    = errors.New("multi-tenancy is not enabled")
	// ErrClassVersionConflict rejects an UpdateClass apply whose
	// ExpectedClassVersion no longer matches — the proposer read stale state
	// and must retry from a fresh read.
	ErrClassVersionConflict      = errors.New("class changed concurrently")
	ErrTenantTransitionalState   = errors.New("tenant is in a transitional state")
	ErrReplicaMovementInProgress = errors.New("replica movement in progress")
)

// PartialUpdateError wraps one or more schema errors that represent a partial
// success: some entries in the request were skipped (e.g. missing or
// transitional-state tenants), but the remaining entries were applied and the
// DB update should still proceed for them. The wrapped errors are returned to
// the caller after the DB update completes.
type PartialUpdateError struct {
	Errs []error
}

func (e *PartialUpdateError) Error() string {

View on GitHub (pinned to 75aa4b6d11)