{"record":{"id":"704aca41f1cd1e85","repo":"weaviate/weaviate","slug":"multi-tenancy-is-not-enabled","errorCode":null,"errorMessage":"multi-tenancy is not enabled","messagePattern":"multi-tenancy is not enabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cluster/schema/schema.go","lineNumber":41,"sourceCode":"\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/prometheus/client_golang/prometheus/promauto\"\n\n\tcommand \"github.com/weaviate/weaviate/cluster/proto/api\"\n\t\"github.com/weaviate/weaviate/cluster/types\"\n\t\"github.com/weaviate/weaviate/entities/models\"\n\tentSchema \"github.com/weaviate/weaviate/entities/schema\"\n\t\"github.com/weaviate/weaviate/entities/versioned\"\n\t\"github.com/weaviate/weaviate/usecases/schema/namespacing\"\n\t\"github.com/weaviate/weaviate/usecases/sharding\"\n)\n\nvar (\n\tErrClassExists   = errors.New(\"class already exists\")\n\tErrClassNotFound = errors.New(\"class not found\")\n\tErrShardNotFound = errors.New(\"shard not found\")\n\tErrAliasExists   = errors.New(\"alias already exists\")\n\tErrAliasNotFound = errors.New(\"alias not found\")\n\tErrMTDisabled    = errors.New(\"multi-tenancy is not enabled\")\n\t// ErrClassVersionConflict rejects an UpdateClass apply whose\n\t// ExpectedClassVersion no longer matches — the proposer read stale state\n\t// and must retry from a fresh read.\n\tErrClassVersionConflict      = errors.New(\"class changed concurrently\")\n\tErrTenantTransitionalState   = errors.New(\"tenant is in a transitional state\")\n\tErrReplicaMovementInProgress = errors.New(\"replica movement in progress\")\n)\n\n// PartialUpdateError wraps one or more schema errors that represent a partial\n// success: some entries in the request were skipped (e.g. missing or\n// transitional-state tenants), but the remaining entries were applied and the\n// DB update should still proceed for them. The wrapped errors are returned to\n// the caller after the DB update completes.\ntype PartialUpdateError struct {\n\tErrs []error\n}\n\nfunc (e *PartialUpdateError) Error() string {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/cluster/schema/schema.go#L23-L59","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Skip tenant operations for collections where MT is disabled (check the class schema first).","Route tenant-scoped traffic only to MT-enabled collections in your data-access layer.","Verify class config with GET /v1/schema/{class} and inspect multiTenancyConfig."],"exampleFix":"// before\nclient.Schema().TenantsCreator().WithClassName(\"Legacy\").WithTenants(t).Do(ctx) // MT off\n// after\nclass, _ := client.Schema().ClassGetter().WithClassName(\"Legacy\").Do(ctx)\nif class.MultiTenancy != nil && class.MultiTenancy.Enabled {\n    client.Schema().TenantsCreator().WithClassName(\"Legacy\").WithTenants(t).Do(ctx)\n}","handlingStrategy":"validation","validationCode":"// Go: check MT is enabled before tenant ops\ncls, err := client.Schema().ClassGetter().WithClassName(class).Do(ctx)\nif err != nil {\n    return err\n}\nif cls.MultiTenancy == nil || !cls.MultiTenancy.Enabled {\n    return fmt.Errorf(\"class %q has multi-tenancy disabled; cannot manage tenants\", class)\n}","typeGuard":"// Go\nfunc isMTDisabled(err error) bool { return errors.Is(err, schema.ErrMTDisabled) }\nfunc mtEnabled(cls *models.Class) bool { return cls != nil && cls.MultiTenancy != nil && cls.MultiTenancy.Enabled }","tryCatchPattern":"if err != nil && errors.Is(err, schema.ErrMTDisabled) {\n    return fmt.Errorf(\"tenant operation not applicable to non-MT class: %w\", err)\n}","preventionTips":["Enable multiTenancyConfig at class creation; it cannot be toggled on later without recreating the class.","Branch tenant vs non-tenant data paths on the class config, not on caller assumptions.","Validate class config in deployment health checks before running tenant automation."],"tags":["go","multi-tenancy","schema","configuration"],"backgroundTag":"multi-tenancy-not-enabled","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}