{"record":{"id":"15468ed0e1e2583a","repo":"weaviate/weaviate","slug":"error-ensuring-tenant-active-for-write-w-15468e","errorCode":null,"errorMessage":"error ensuring tenant active for write: %w","messagePattern":"error ensuring tenant active for write: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/objects/delete.go","lineNumber":65,"sourceCode":"\tif err := m.allocChecker.CheckAlloc(memwatch.EstimateObjectDeleteMemory()); err != nil {\n\t\tm.logger.WithError(err).Errorf(\"memory pressure: cannot process delete object\")\n\t\treturn fmt.Errorf(\"cannot process delete object: %w\", err)\n\t}\n\n\tm.metrics.DeleteObjectInc()\n\tdefer m.metrics.DeleteObjectDec()\n\n\t// we only use the schemaVersion in this endpoint\n\tfetchedClasses, err := m.schemaManager.GetCachedClassNoAuth(ctx, className)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get class %s: %w\", className, err)\n\t}\n\n\tmaxSchemaVersion := fetchedClasses[className].Version\n\tif tenant != \"\" {\n\t\ttenantSchemaVersion, err := m.schemaManager.EnsureTenantActiveForWrite(ctx, className, tenant)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error ensuring tenant active for write: %w\", err)\n\t\t}\n\t\tmaxSchemaVersion = max(maxSchemaVersion, tenantSchemaVersion)\n\t}\n\n\tif className == \"\" { // deprecated\n\t\treturn m.deleteObjectFromRepo(ctx, id, time.UnixMilli(m.timeSource.Now()), maxSchemaVersion)\n\t}\n\n\tif err = m.vectorRepo.DeleteObject(ctx, className, id, time.UnixMilli(m.timeSource.Now()), repl, tenant, maxSchemaVersion); err != nil {\n\t\tvar e1 ErrMultiTenancy\n\t\tif errors.As(err, &e1) {\n\t\t\treturn NewErrMultiTenancy(fmt.Errorf(\"delete object from vector repo: %w\", err))\n\t\t}\n\t\tvar e2 ErrInvalidUserInput\n\t\tif errors.As(err, &e2) {\n\t\t\treturn NewErrMultiTenancy(fmt.Errorf(\"delete object from vector repo: %w\", err))\n\t\t}\n\t\treturn NewErrInternal(\"could not delete object from vector repo: %w\", err)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/delete.go#L47-L83","documentation":"Wraps a failure from schemaManager.EnsureTenantActiveForWrite. When a tenant parameter is supplied, Weaviate must confirm the tenant exists on the class and is in an ACTIVE state (not COLD, FROZEN, or OFFLOADED) before it can accept the delete. Any error from that tenant check — missing tenant, inactive/offloaded tenant, or lookup failure — is wrapped here.","triggerScenarios":"DELETE /v1/objects/{className}/{id}?tenant=X (or the multi-tenancy API) where tenant X does not exist on the class, is not ACTIVE (e.g. offloaded to cold storage), or the tenant-status lookup fails.","commonSituations":"Deleting an object for a tenant that was never created; tenant auto-offloading has moved the tenant to COLD/FROZEN state; typo'd tenant name; multi-tenancy enabled but the tenant parameter omitted or wrong-shard routing during rebalancing.","solutions":["Check tenant status: GET /v1/schema/{className}/tenants/{tenant} — recreate it or reactivate it if not ACTIVE","Reactivate an offloaded tenant (update its status to ACTIVE) before deleting objects","Fix the tenant name in the request (exact match required)","If the tenant exists and is active but the error persists, inspect the wrapped error for shard/cluster routing problems"],"exampleFix":"// before: delete without checking tenant status\nclass, err := client.Data().Deleter().WithClassName(\"Article\").WithTenant(\"acme\").Do(ctx)\n// after: ensure tenant is ACTIVE first\ntenants, _ := client.Schema().TenantsGetter().WithClassName(\"Article\").Do(ctx)\nif tenants[0].ActivityStatus != \"ACTIVE\" {\n  client.Schema().TenantsUpdater().WithClassName(\"Article\").WithTenant(...).Do(ctx) // set ACTIVE\n}","handlingStrategy":"validation","validationCode":"// Confirm tenant exists and is ACTIVE before deleting\nconst tenants = await client.schema.tenantsGetter().withClassName('Article').do();\nconst t = tenants.find(t => t.name === 'acme');\nif (!t || t.activityStatus !== 'ACTIVE') throw new Error(`tenant acme not ACTIVE`);","typeGuard":null,"tryCatchPattern":"try {\n  await client.data.deleter().withClassName('Article').withID(id).withTenant('acme').do();\n} catch (e) {\n  if (String(e).includes('ensuring tenant active for write')) {\n    // reactivate or recreate the tenant, then retry once\n    await client.schema.tenantUpdater().withClassName('Article').withTenant({name:'acme', activityStatus:'ACTIVE'}).do();\n  } else throw e;\n}","preventionTips":["Check tenant status before every MT write","Enable auto-offloading awareness — reactivate tenants before scheduled maintenance","Validate tenant names against the schema, not user input directly","Monitor tenant activity status transitions in your orchestration"],"tags":["go","multi-tenancy","tenant-status"],"backgroundTag":"tenant-not-active","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"}