{"record":{"id":"582828ff74885b9f","repo":"weaviate/weaviate","slug":"error-ensuring-tenant-active-for-write-w","errorCode":null,"errorMessage":"error ensuring tenant active for write: %w","messagePattern":"error ensuring tenant active for write: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/objects/batch_delete.go","lineNumber":92,"sourceCode":"\tschemaVersion := fetchedClasses[className].Version\n\n\tdeletionTime := time.UnixMilli(b.timeSource.Now())\n\treturn b.vectorRepo.BatchDeleteObjects(ctx, params, deletionTime, repl, tenant, schemaVersion)\n}\n\nfunc (b *BatchManager) deleteObjects(ctx context.Context, principal *models.Principal,\n\tmatch *models.BatchDeleteMatch, deletionTimeUnixMilli *int64, dryRun *bool, output *string,\n\trepl *additional.ReplicationProperties, tenant string,\n) (*BatchDeleteResponse, error) {\n\tparams, schemaVersion, err := b.validateBatchDelete(ctx, principal, match, dryRun, output)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"validate\")\n\t}\n\n\tif tenant != \"\" {\n\t\ttenantSchemaVersion, err := b.schemaManager.EnsureTenantActiveForWrite(ctx, string(params.ClassName), tenant)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error ensuring tenant active for write: %w\", err)\n\t\t}\n\t\tschemaVersion = max(schemaVersion, tenantSchemaVersion)\n\t}\n\n\t// Wait so tenant activation is visible locally before shard resolution and delete.\n\tif err := b.schemaManager.WaitForUpdate(ctx, schemaVersion); err != nil {\n\t\treturn nil, fmt.Errorf(\"error waiting for local schema to catch up to version %d: %w\", schemaVersion, err)\n\t}\n\n\tvar deletionTime time.Time\n\tif deletionTimeUnixMilli != nil {\n\t\tdeletionTime = time.UnixMilli(*deletionTimeUnixMilli)\n\t}\n\n\tresult, err := b.vectorRepo.BatchDeleteObjects(ctx, *params, deletionTime, repl, tenant, schemaVersion)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"batch delete objects: %w\", err)\n\t}","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/batch_delete.go#L74-L110","documentation":"Ensuring the target tenant is active for write failed while preparing a batch delete. The tenant may not exist yet, its activation is still propagating through the cluster, or the schema wait was cancelled.","triggerScenarios":"POST /v1/batch/delete with a tenant parameter where the tenant is COLD/inactive and cannot be activated — schema update rejected, authorization failure, or cluster error during EnsureTenantActiveForWrite.","commonSituations":"Batch-deleting from a COLD tenant without permission to activate; cluster cannot commit the tenant status change; deleted or misspelled tenant name passed in the request.","solutions":["Verify the tenant exists and is active on the class","Retry the batch delete once tenant activation completes","Check raft/schema propagation health"],"exampleFix":"// before\n// batch delete from tenant \"cold-tenant\" -> error\n// after\n_, err := client.Schema().TenantsUpdater(ctx, className,\n  []models.Tenant{{Name: \"cold-tenant\", ActivityStatus: models.TenantActivityStatusHOT}})\nif err != nil { return err }\n// then run the batch delete","handlingStrategy":"retry","validationCode":"tenants, err := client.Schema().TenantsGetter(ctx, className)\nif err != nil { return err }\nfor _, t := range tenants {\n  if t.Name == tenantName && t.ActivityStatus != nil &&\n     *t.ActivityStatus != models.TenantActivityStatusACTIVE {\n    return fmt.Errorf(\"tenant %s not writable (status %s)\", tenantName, *t.ActivityStatus)\n  }\n}","typeGuard":null,"tryCatchPattern":"err := batchDelete(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"ensuring tenant active\") {\n  if err := activateTenant(ctx, className, tenantName); err != nil { return err }\n  return batchDelete(ctx, req)\n}","preventionTips":["Activate tenants before deletes instead of relying on implicit activation.","Verify tenant names exist before issuing tenant-scoped deletes.","Ensure delete principals can update tenant status.","Schedule COLD/offloaded tenant writes after reactivation."],"tags":["batch-delete","multi-tenancy","tenant-activation"],"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"}