weaviate/weaviate · error

LazyLoadShard::preventShutdown: %w

Error message

LazyLoadShard::preventShutdown: %w

What it means

preventShutdown ensures a shard is loaded and protected from being shut down (e.g. during replication or maintenance), returning a release func to undo the protection. When the LazyLoadShard is cold, it first calls Load; this error wraps any Load failure (memory pressure rejection, load-limiter permit failure, reindex errors), so the shutdown protection cannot be established.

Source

Thrown at adapters/repos/db/shard_lazyloader.go:854

	l.mutex.Lock()
	defer l.mutex.Unlock()

	if !l.loaded {
		return nil
	}

	if err := l.shard.Shutdown(ctx); err != nil {
		return err
	}

	// Mark as unloaded so drop() knows the correct state
	l.loaded = false
	return nil
}

func (l *LazyLoadShard) preventShutdown() (release func(), err error) {
	if err := l.Load(context.Background()); err != nil {
		return func() {}, fmt.Errorf("LazyLoadShard::preventShutdown: %w", err)
	}
	return l.shard.preventShutdown()
}

// HashTreeLevel maps unloaded to ErrAsyncReplicationNotActive; an empty level would read as convergence.
func (l *LazyLoadShard) HashTreeLevel(ctx context.Context, level int, discriminant *hashtree.Bitset) (digests []hashtree.Digest, err error) {
	if !l.isLoaded() {
		return nil, errAsyncReplicationNotActive
	}
	return l.shard.HashTreeLevel(ctx, level, discriminant)
}

// CreateAsyncCheckpoint maps unloaded to ErrAsyncReplicationNotActive so transports
// return REST 412 / gRPC FailedPrecondition (matching the loaded path).
func (l *LazyLoadShard) CreateAsyncCheckpoint(ctx context.Context, cutoffMs int64, createdAt time.Time) error {
	if !l.isLoaded() {
		return errAsyncReplicationNotActive
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Free memory or wait for load pressure to drop, then retry the operation.
  2. Increase the shard-load limiter concurrency or reduce competing shard loads.
  3. Retry the parent operation (e.g. replication step) once the shard can load.
  4. Investigate the inner Load error from the message — it names the exact cause (memory pressure vs permit vs reindex).
Defensive patterns

Strategy: retry

Validate before calling

// before operations that protect shards from shutdown, check node memory headroom
// if memoryPressure() { return errors.New("defer: node under memory pressure") }

Try / catch

release, err := lazyShard.preventShutdown()
if err != nil {
	if strings.Contains(err.Error(), "preventShutdown") && strings.Contains(err.Error(), "memory pressure") {
		time.Sleep(backoff); release, err = lazyShard.preventShutdown() // retry after pressure drops
	}
	if err != nil { return err }
}
defer release()

Prevention

When it happens

Trigger: Calling preventShutdown on an unloaded shard while Load fails — most commonly memory-pressure reservation failure (CheckMappingAndReserve) or inability to acquire a shard-load permit (context cancelled/timeout).

Common situations: Nodes under memory pressure refusing shard loads; saturated shard-load limiter during bulk operations; operations like async replication or offloading trying to protect a cold tenant's shard.

Related errors


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