{"record":{"id":"25846699aa8dbe3c","repo":"weaviate/weaviate","slug":"ensure-tenant-active-w","errorCode":null,"errorMessage":"ensure tenant active: %w","messagePattern":"ensure tenant active: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/objects/batch_add.go","lineNumber":123,"sourceCode":"\t\treturn nil, fmt.Errorf(\"auto create tenants: %w\", err)\n\t}\n\n\tmaxSchemaVersion = max(maxSchemaVersion, schemaVersion)\n\n\t// ensure tenants are active when AutoTenantActivation is enabled\n\tclassTenants := make(map[string][]string)\n\tfor _, obj := range objects {\n\t\tif obj.Tenant == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tclassTenants[obj.Class] = append(classTenants[obj.Class], obj.Tenant)\n\t}\n\tfor className, tenants := range classTenants {\n\t\tslices.Sort(tenants)\n\t\ttenants = slices.Compact(tenants)\n\t\tactivationVersion, err := b.schemaManager.EnsureTenantActiveForWrite(ctx, className, tenants...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ensure tenant active: %w\", err)\n\t\t}\n\t\tmaxSchemaVersion = max(maxSchemaVersion, activationVersion)\n\t}\n\n\tb.metrics.BatchTenants(tenantCount)\n\tb.metrics.BatchObjects(len(objects))\n\tb.metrics.BatchOp(\"total_preprocessing\", beforePreProcessing.UnixNano())\n\n\tvar res BatchObjects\n\n\tbeforePersistence := time.Now()\n\tdefer b.metrics.BatchOp(\"total_persistence_level\", beforePersistence.UnixNano())\n\n\tif res, err = b.vectorRepo.BatchPutObjects(ctx, batchObjects, repl, maxSchemaVersion); err != nil {\n\t\treturn nil, NewErrInternal(\"batch objects: %w\", err)\n\t}\n\n\t// Reaggregate a unanimous limit-exceeded into a top-level error so","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/batch_add.go#L105-L141","documentation":"Wrapped error from addObjects when EnsureTenantActiveForWrite fails while the batch tries to activate tenant placeholders (autoTenantActivation enabled). The batch aborts because objects must land on an ACTIVE tenant.","triggerScenarios":"Batch import with autoTenantCreation and autoTenantActivation against a collection where activation of the just-created (or existing COLD) tenant fails — schema update rejected, auth failure, or context deadline exceeded.","commonSituations":"Writing to tenants left in COLD status where auto-activation cannot complete; cluster lag where activation cannot propagate; RBAC principal missing rights to mutate tenant status.","solutions":["Inspect the wrapped cause for the actual schema/activation failure.","Verify the tenant exists and can transition to ACTIVE via /v1/schema/{class}/tenants.","Grant the principal schema-write authorization for tenant activation.","Activate tenants explicitly before batch imports if autoTenantActivation keeps failing."],"exampleFix":"// before\nresp, err := client.Batch.ObjectsBatchCreate(ctx, batch) // fails on COLD tenant\n// after\n_, err := client.Schema().TenantsUpdater(ctx, className,\n  []models.Tenant{{Name: t, ActivityStatus: models.TenantActivityStatusHOT}})\nif err != nil { return err }\nresp, err = client.Batch.ObjectsBatchCreate(ctx, batch)","handlingStrategy":"validation","validationCode":"tenants, err := client.Schema().TenantsGetter(ctx, className)\nif err != nil { return err }\nfor _, t := range tenants {\n  if t.ActivityStatus == nil || *t.ActivityStatus != models.TenantActivityStatusACTIVE {\n    return fmt.Errorf(\"tenant %s not active in %s\", t.Name, className)\n  }\n}","typeGuard":null,"tryCatchPattern":"err := batch(ctx, objects)\nif err != nil && strings.Contains(err.Error(), \"ensure tenant active\") {\n  activateTenants(ctx, className, tenants) // explicit activation then retry\n}","preventionTips":["Check tenant status (ACTIVE/HOT) before batch imports.","Use autoTenantActivation only when the writer can activate tenants.","Grant schema-write RBAC to importing principals.","Avoid leaving tenants in COLD state if they receive frequent writes."],"tags":["batch","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"}