weaviate/weaviate · error

error ensuring tenant active for write: %w

Error message

error ensuring tenant active for write: %w

What it means

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.

Source

Thrown at usecases/objects/delete.go:65

	if err := m.allocChecker.CheckAlloc(memwatch.EstimateObjectDeleteMemory()); err != nil {
		m.logger.WithError(err).Errorf("memory pressure: cannot process delete object")
		return fmt.Errorf("cannot process delete object: %w", err)
	}

	m.metrics.DeleteObjectInc()
	defer m.metrics.DeleteObjectDec()

	// we only use the schemaVersion in this endpoint
	fetchedClasses, err := m.schemaManager.GetCachedClassNoAuth(ctx, className)
	if err != nil {
		return fmt.Errorf("could not get class %s: %w", className, err)
	}

	maxSchemaVersion := fetchedClasses[className].Version
	if tenant != "" {
		tenantSchemaVersion, err := m.schemaManager.EnsureTenantActiveForWrite(ctx, className, tenant)
		if err != nil {
			return fmt.Errorf("error ensuring tenant active for write: %w", err)
		}
		maxSchemaVersion = max(maxSchemaVersion, tenantSchemaVersion)
	}

	if className == "" { // deprecated
		return m.deleteObjectFromRepo(ctx, id, time.UnixMilli(m.timeSource.Now()), maxSchemaVersion)
	}

	if err = m.vectorRepo.DeleteObject(ctx, className, id, time.UnixMilli(m.timeSource.Now()), repl, tenant, maxSchemaVersion); err != nil {
		var e1 ErrMultiTenancy
		if errors.As(err, &e1) {
			return NewErrMultiTenancy(fmt.Errorf("delete object from vector repo: %w", err))
		}
		var e2 ErrInvalidUserInput
		if errors.As(err, &e2) {
			return NewErrMultiTenancy(fmt.Errorf("delete object from vector repo: %w", err))
		}
		return NewErrInternal("could not delete object from vector repo: %w", err)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check tenant status: GET /v1/schema/{className}/tenants/{tenant} — recreate it or reactivate it if not ACTIVE
  2. Reactivate an offloaded tenant (update its status to ACTIVE) before deleting objects
  3. Fix the tenant name in the request (exact match required)
  4. If the tenant exists and is active but the error persists, inspect the wrapped error for shard/cluster routing problems

Example fix

// before: delete without checking tenant status
class, err := client.Data().Deleter().WithClassName("Article").WithTenant("acme").Do(ctx)
// after: ensure tenant is ACTIVE first
tenants, _ := client.Schema().TenantsGetter().WithClassName("Article").Do(ctx)
if tenants[0].ActivityStatus != "ACTIVE" {
  client.Schema().TenantsUpdater().WithClassName("Article").WithTenant(...).Do(ctx) // set ACTIVE
}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm tenant exists and is ACTIVE before deleting
const tenants = await client.schema.tenantsGetter().withClassName('Article').do();
const t = tenants.find(t => t.name === 'acme');
if (!t || t.activityStatus !== 'ACTIVE') throw new Error(`tenant acme not ACTIVE`);

Try / catch

try {
  await client.data.deleter().withClassName('Article').withID(id).withTenant('acme').do();
} catch (e) {
  if (String(e).includes('ensuring tenant active for write')) {
    // reactivate or recreate the tenant, then retry once
    await client.schema.tenantUpdater().withClassName('Article').withTenant({name:'acme', activityStatus:'ACTIVE'}).do();
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/15468ed0e1e2583a. Report an issue: GitHub.