{"record":{"id":"4ec613a37b38a70f","repo":"weaviate/weaviate","slug":"errmtdisabled","errorCode":"ErrMTDisabled","errorMessage":"multi-tenancy disabled for class %q (wrapped with ErrMTDisabled)","messagePattern":"multi-tenancy disabled for class %q \\(wrapped with ErrMTDisabled\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cluster/schema/schema.go","lineNumber":372,"sourceCode":"\nfunc (s *schema) len() int {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\treturn len(s.classes)\n}\n\nfunc (s *schema) multiTenancyEnabled(class string) (bool, *metaClass, ClassInfo, error) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tmeta := s.unsafeResolveClass(class)\n\tif meta == nil {\n\t\treturn false, nil, ClassInfo{}, ErrClassNotFound\n\t}\n\tinfo := s.unsafeResolveClass(class).ClassInfo()\n\tif !info.MultiTenancy.Enabled {\n\t\treturn false, nil, ClassInfo{}, fmt.Errorf(\"%w for class %q\", ErrMTDisabled, class)\n\t}\n\treturn true, meta, info, nil\n}\n\nfunc (s *schema) addClass(cls *models.Class, ss *sharding.State, v uint64) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\t_, exists := s.classes[cls.Class]\n\tif exists {\n\t\treturn ErrClassExists\n\t}\n\n\ts.classes[cls.Class] = &metaClass{\n\t\tClass: *cls, Sharding: *ss, ClassVersion: v, ShardVersion: v,\n\t}\n\n\tns := namespacing.NamespaceFromQualified(cls.Class)","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/cluster/schema/schema.go#L354-L390","documentation":"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.","triggerScenarios":"Calling any tenant API (add/update/delete/get tenants, tenant process) against a class created without multi-tenancy enabled in its class definition.","commonSituations":"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.","solutions":["Enable multi-tenancy by recreating the class with {\"multiTenancy\": {\"enabled\": true}} (cannot be toggled on an existing class)","Point the tenant API calls at the correct multi-tenant collection name","For single-tenant collections, store data as plain objects instead of tenants","Update automation/client code to check MultiTenancy.Enabled via the schema before calling tenant endpoints"],"exampleFix":"// before\nclient.Schema().ClassCreator().WithClass(&models.Class{Class: \"Docs\"}).Do() // MT off\nclient.Data().TenantsCreator().WithClass(\"Docs\").WithTenants(...).Do() // ErrMTDisabled\n// after\nclient.Schema().ClassCreator().WithClass(&models.Class{Class: \"Docs\", MultiTenancy: &models.MultiTenancyConfig{Enabled: true}}).Do()","handlingStrategy":"validation","validationCode":"cls, err := client.Schema().ClassGetter().WithClassName(class).Do(ctx)\nif err != nil { return err }\nif cls.Class == nil || cls.Class.MultiTenancy == nil || !cls.Class.MultiTenancy.Enabled { return ErrMTDisabled }","typeGuard":"func multiTenancyEnabled(c *models.Class) bool {\n  return c != nil && c.MultiTenancy != nil && c.MultiTenancy.Enabled\n}","tryCatchPattern":"if errors.Is(err, schema.ErrMTDisabled) { recreateClassWithMTEnabled() }","preventionTips":["Always create collections with multiTenancy.enabled=true when tenants will be used","Cannot toggle MT at runtime — plan collection creation accordingly","Check the schema before tenant API calls in tooling","Validate class names in client configs point at MT-enabled collections"],"tags":["multi-tenancy","schema-configuration","class-config"],"backgroundTag":"multi-tenancy-disabled","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}