{"record":{"id":"caaf5803976c9e77","repo":"weaviate/weaviate","slug":"getting-objects-bucket-class-name-w-caaf58","errorCode":null,"errorMessage":"getting objects bucket class name: %w","messagePattern":"getting objects bucket class name: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/inverted_reindexer_specified_index.go","lineNumber":152,"sourceCode":"\t\tPropertyPaths: propertyPaths,\n\t}\n\n\treturn func(ctx context.Context, fn func(object *storobj.Object) error) error {\n\t\t// resolved per call, not once at wiring time: a teardown between the\n\t\t// two would leave this closure holding a bucket that no longer exists.\n\t\t// Pinned for the whole cursor, so a teardown starting mid-scan waits\n\t\t// rather than unmapping the segments the cursor reads.\n\t\tobjectsBucket, release := shard.Store().AcquireBucketForRead(helpers.ObjectsBucketLSM)\n\t\tif objectsBucket == nil {\n\t\t\treturn fmt.Errorf(\"objects bucket of shard %q: %w\", shard.Name(), lsmkv.ErrBucketNotFound)\n\t\t}\n\t\tdefer release()\n\n\t\tcursor := objectsBucket.Cursor()\n\t\tdefer cursor.Close()\n\t\tclassName, err := objectsBucket.ClassName()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting objects bucket class name: %w\", err)\n\t\t}\n\t\ti := 0\n\t\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\t\tobj, err := storobj.FromBinaryOptionalDisk(v, className, additional.Properties{}, propsExtraction)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot unmarshal object %d, %w\", i, err)\n\t\t\t}\n\t\t\tif err := fn(obj); err != nil {\n\t\t\t\treturn fmt.Errorf(\"callback on object '%d' failed: %w\", obj.DocID, err)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\treturn nil\n\t}\n}\n","sourceCodeStart":134,"sourceCodeEnd":168,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted_reindexer_specified_index.go#L134-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the shard's disk health and LSM store logs for corruption; restore the shard from a backup if metadata is unreadable.","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.","Retry the reindex after restarting the node so buckets are re-created cleanly from disk."],"exampleFix":"// before\nbucket, err := lsmkv.NewBucket(dir, opts...) // className not set\ncn, err := bucket.ClassName() // fails later\n\n// after\nbucket, err := store.GetBucket(ShardWriteWALDisabledBucketOptions(className))\ncn, err := bucket.ClassName() // returns configured class name","handlingStrategy":"try-catch","validationCode":"// Go: no pre-call check exists for ClassName; verify shard dir health\nif _, err := os.Stat(shardDir); err != nil {\n    return fmt.Errorf(\"shard dir unavailable, skip reindex: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := index.IterateObjects(ctx, cb)\nif err != nil {\n    var wrapped *fmt.WrapError\n    if errors.As(err, &wrapped) && strings.Contains(err.Error(), \"getting objects bucket class name\") {\n        logger.Errorf(\"shard bucket unusable, restore from backup before reindex: %v\", err)\n    }\n    return err\n}","preventionTips":["Always obtain buckets via the shard/store standard options path so className metadata is set.","Monitor disk health and run integrity checks before long reindex operations.","Keep recent backups of shards before triggering reindexing."],"tags":["storage","lsmkv","reindexing","go"],"backgroundTag":"lsm-bucket-metadata-unreadable","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"}