weaviate/weaviate · error

getting objects bucket class name: %w

Error message

getting objects bucket class name: %w

What it means

This error wraps a failure from objectsBucket.ClassName() while the inverted-index reindexer iterates all objects in a shard's objects bucket via a cursor. The LSM bucket failed to report the class name it was created with, so the reindexer cannot unmarshal objects into the correct schema and aborts the whole iteration. It indicates the bucket's metadata (class name) is unavailable at read time, typically a corrupt or wrongly-constructed bucket.

Source

Thrown at adapters/repos/db/inverted_reindexer_specified_index.go:152

		PropertyPaths: propertyPaths,
	}

	return func(ctx context.Context, fn func(object *storobj.Object) error) error {
		// resolved per call, not once at wiring time: a teardown between the
		// two would leave this closure holding a bucket that no longer exists.
		// Pinned for the whole cursor, so a teardown starting mid-scan waits
		// rather than unmapping the segments the cursor reads.
		objectsBucket, release := shard.Store().AcquireBucketForRead(helpers.ObjectsBucketLSM)
		if objectsBucket == nil {
			return fmt.Errorf("objects bucket of shard %q: %w", shard.Name(), lsmkv.ErrBucketNotFound)
		}
		defer release()

		cursor := objectsBucket.Cursor()
		defer cursor.Close()
		className, err := objectsBucket.ClassName()
		if err != nil {
			return fmt.Errorf("getting objects bucket class name: %w", err)
		}
		i := 0
		for k, v := cursor.First(); k != nil; k, v = cursor.Next() {
			obj, err := storobj.FromBinaryOptionalDisk(v, className, additional.Properties{}, propsExtraction)
			if err != nil {
				return fmt.Errorf("cannot unmarshal object %d, %w", i, err)
			}
			if err := fn(obj); err != nil {
				return fmt.Errorf("callback on object '%d' failed: %w", obj.DocID, err)
			}
			i++
		}
		return nil
	}
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check the shard's disk health and LSM store logs for corruption; restore the shard from a backup if metadata is unreadable.
  2. Verify the bucket is created via the shard's standard bucket-get path so the className option is set, not a hand-rolled NewBucket call.
  3. Retry the reindex after restarting the node so buckets are re-created cleanly from disk.

Example fix

// before
bucket, err := lsmkv.NewBucket(dir, opts...) // className not set
cn, err := bucket.ClassName() // fails later

// after
bucket, err := store.GetBucket(ShardWriteWALDisabledBucketOptions(className))
cn, err := bucket.ClassName() // returns configured class name
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: no pre-call check exists for ClassName; verify shard dir health
if _, err := os.Stat(shardDir); err != nil {
    return fmt.Errorf("shard dir unavailable, skip reindex: %w", err)
}

Try / catch

err := index.IterateObjects(ctx, cb)
if err != nil {
    var wrapped *fmt.WrapError
    if errors.As(err, &wrapped) && strings.Contains(err.Error(), "getting objects bucket class name") {
        logger.Errorf("shard bucket unusable, restore from backup before reindex: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling IterateObjects (the reindexer's objects callback loop) on a shard whose underlying LSM 'objects' bucket returns an error from Bucket.ClassName(); happens before any object is read, on cursor setup.

Common situations: Corrupted shard directory after a crash, a bucket opened without the className option set (bucket opened with the wrong constructor/options), or storage-disk I/O errors while reading bucket metadata during a reindex of a specified inverted index.

Related errors


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