{"record":{"id":"a1332234726e4e9d","repo":"weaviate/weaviate","slug":"rangeable-index-for-property-q-could-not-be-activ","errorCode":null,"errorMessage":"rangeable index for property %q could not be activated for in-memory serving: bucket %q not found post-swap, rebuild the index to repair it","messagePattern":"rangeable index for property %q could not be activated for in-memory serving: bucket %q not found post-swap, rebuild the index to repair it","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/inverted_reindex_task_generic.go","lineNumber":850,"sourceCode":"\t\t!shard.Index().Config.IndexRangeableInMemory {\n\t\treturn nil\n\t}\n\n\tstore := shard.Store()\n\tclassName := shard.Index().Config.ClassName.String()\n\tshardName := shard.Name()\n\tfor _, propName := range props {\n\t\tbucketName := t.strategy.SourceBucketName(propName)\n\n\t\tbucket := store.Bucket(bucketName)\n\t\tif bucket == nil {\n\t\t\tif ctxErr := ctx.Err(); ctxErr != nil {\n\t\t\t\t// Missing buckets have legitimate transient causes (shutdown\n\t\t\t\t// draining, a property dropped mid-migration); only treat this\n\t\t\t\t// as a hard failure once we know the caller isn't shutting down.\n\t\t\t\treturn fmt.Errorf(\"rangeable in-memory rebuild aborted for property %q: %w\", propName, ctxErr)\n\t\t\t}\n\t\t\terr := fmt.Errorf(\n\t\t\t\t\"rangeable index for property %q could not be activated for in-memory \"+\n\t\t\t\t\t\"serving: bucket %q not found post-swap, rebuild the index to repair it\",\n\t\t\t\tpropName, bucketName,\n\t\t\t)\n\t\t\tlogger.WithField(\"bucket\", bucketName).Errorf(\"rangeable in-memory rebuild: %v\", err)\n\t\t\tmonitoring.GetMetrics().IncRangeableInMemoryRebuildDegraded(className, shardName, propName)\n\t\t\tcontinue\n\t\t}\n\n\t\tstarted := time.Now()\n\t\tif err := t.rebuildRangeableRepFn(ctx, bucket); err != nil {\n\t\t\tif ctxErr := ctx.Err(); ctxErr != nil {\n\t\t\t\t// Wrap ctxErr too: it guarantees errors.Is(context.Canceled)\n\t\t\t\t// works even if the underlying err doesn't itself wrap\n\t\t\t\t// ctx.Err(); err is kept for diagnostics.\n\t\t\t\treturn fmt.Errorf(\"rangeable in-memory rebuild aborted for property %q: %w: %w\", propName, ctxErr, err)\n\t\t\t}\n\t\t\twrapped := fmt.Errorf(","sourceCodeStart":832,"sourceCodeEnd":868,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted_reindex_task_generic.go#L832-L868","documentation":"After a reindex swap completes, the source bucket for a rangeable property must be present in the LSM store so its in-memory rangeable representation can be rebuilt. If `store.Bucket(bucketName)` returns nil and the context is NOT cancelled, this is a hard state divergence: the bucket that should have been promoted/loaded is missing post-swap. The migration does not fail (data on disk is intact and disk serving remains correct), but the shard is degraded — range queries for this property serve from disk instead of memory, and a degraded-rebuild metric is incremented.","triggerScenarios":"Triggered when `store.Bucket(bucketName)` is nil for a rangeable property after a bucket swap with a live context: the swap promoted a bucket that was later removed from the in-memory map, an interrupted runtimeSwap removed the bucket without persisting the sentinel, a property was dropped mid-migration, or the bucket dir is genuinely gone on disk.","commonSituations":"A previous crash/shutdown interrupted the swap midway leaving inconsistent in-memory vs on-disk bucket state; manual deletion or corruption of an LSM bucket directory under the shard's lsm path; version-upgrade recovery paths re-loading shards; operators deleting reindex/ingest bucket directories to reclaim disk space.","solutions":["Rebuild the index for the affected collection/property (as the message says): trigger a reindex so the bucket is recreated and promoted correctly.","Check the shard's LSM directory on disk: if the bucket directory exists but is not loaded, restart the node — OnAfterLsmInit / ensureReindexBucketsLoadedForSwap will defensively load it.","If the bucket directory is genuinely missing, restore from backup or reindex; do not hand-create empty bucket dirs.","Inspect logs for an earlier interrupted runtimeSwap or 'reindex bucket not found' to find the root cause of the state divergence, and check the rangeable_rebuild_degraded metric for affected shard/property."],"exampleFix":"// after an interrupted swap left the bucket unloaded, on the operator side:\n// 1. verify the dir exists\nls /var/lib/weaviate/<index>/<shard>/lsm-kythe/<bucket-dir>\n// 2. restart weaviate so OnAfterLsmInit loads it; if dir is gone:\n//    re-index the collection via GraphQL/REST (update the schema or use the repair/reindex flow)","handlingStrategy":"validation","validationCode":"// verify all expected rangeable buckets are loaded before assuming a healthy shard:\nstore := shard.Store()\nfor _, prop := range rangeableProps {\n    if store.Bucket(strategy.SourceBucketName(prop)) == nil {\n        logger.Warnf(\"bucket for property %q not loaded; triggering defensive reload/reindex\", prop)\n    }\n}","typeGuard":"func bucketLoaded(store *lsmkv.Store, name string) bool { return store.Bucket(name) != nil }","tryCatchPattern":"if err := finalize(ctx, shard, props); err != nil {\n    var degraded *DegradedRebuildError\n    if errors.As(err, &degraded) {\n        metrics.IncRangeableInMemoryRebuildDegraded(class, shard, degraded.Prop)\n        logger.Errorf(\"degraded to disk serving; schedule reindex: %v\", err)\n        return nil // do not fail the committed migration\n    }\n    return err\n}","preventionTips":["Never manually delete bucket directories under the shard's lsm path.","After an unclean shutdown, check for 'not found post-swap' errors and rebuild affected indexes proactively.","Keep the rangeable_rebuild_degraded metric alerting enabled per class/shard/property.","Keep disk space healthy — full disks can abort bucket creation during swaps.","Back up before schema migrations so missing buckets can be restored without data loss."],"tags":["lsmkv","reindex","missing-bucket","degraded"],"backgroundTag":"bucket-not-found-post-swap","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}