{"record":{"id":"ecd5deabf461510b","repo":"weaviate/weaviate","slug":"rangeable-in-memory-rebuild-aborted-for-property","errorCode":null,"errorMessage":"rangeable in-memory rebuild aborted for property %q: %w","messagePattern":"rangeable in-memory rebuild aborted for property %q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"adapters/repos/db/inverted_reindex_task_generic.go","lineNumber":848,"sourceCode":") error {\n\tif t.strategy.TargetStrategy() != lsmkv.StrategyRoaringSetRange ||\n\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)","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted_reindex_task_generic.go#L830-L866","documentation":"During a reindex migration, `rebuildRangeableInMemoryReps` tries to rebuild the in-memory roaring-set representation for a rangeable property's bucket after the swap. If the bucket is not present in the LSM store AND the context has been cancelled (e.g. graceful shutdown draining), the function aborts and returns the context error wrapped in this message. It is the cancellation branch: the code deliberately distinguishes 'bucket missing because we are shutting down' (transient, retried later) from a genuinely missing bucket.","triggerScenarios":"Triggered when, after a reindex bucket swap, `store.Bucket(bucketName)` returns nil for a rangeable property while `ctx.Err() != nil` — i.e. the caller's context was cancelled or its deadline expired during the migration. Raised from rebuildRangeableInMemoryReps via finalizeMigrationAfterRecovery, OnAfterLsmInitAsync, or runtimeSwap. Server shutdown, shard close, or a cancelled migration ack all produce it.","commonSituations":"Restarting or gracefully stopping Weaviate while a collection reindex (schema migration like a new filterable/rangeable property) is mid-flight; dropping a property while its migration is running; node shutdown draining shards during a rolling upgrade; an operator cancelling a DTM migration task.","solutions":["Do nothing and restart the node cleanly — the migration is recovered on next startup via the recovery task (finalizeMigrationAfterRecovery); this error is transient by design.","Check server logs for the shutdown/cancellation that preceded this (SIGTERM, drain, graceful shutdown) and confirm the reindex resumes after restart.","Ensure the shard context is not being cancelled prematurely (check shard close ordering, request timeouts bound to the migration ctx).","If it appears WITHOUT a shutdown, treat as the non-cancelled variant (errorIndex 1821): the bucket is genuinely missing — rebuild the index."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before relying on finalize results, check context health:\nif err := ctx.Err(); err != nil {\n    // treat migration as transiently interrupted, not failed\n    return fmt.Errorf(\"migration interrupted: %w\", err)\n}","typeGuard":"func isCancellation(err error) bool { return errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) }","tryCatchPattern":"if err := runReindexSwap(ctx, shard, props); err != nil {\n    if isCancellation(err) {\n        logger.Debug(\"reindex interrupted by shutdown; recovery will resume\")\n        return nil // transient ack, not permanent failure\n    }\n    return err\n}","preventionTips":["Never mark a migration permanently FAILED when errors.Is(err, context.Canceled) is true.","Use a background context (not request-scoped) for shard lifecycle/reindex work so client timeouts don't cancel migrations.","Schedule restarts/rolling upgrades outside active reindex windows when possible.","Monitor reindex task acks after restart to confirm the recovery path completed."],"tags":["context-canceled","lsmkv","reindex","shutdown"],"backgroundTag":"context-canceled","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"}