weaviate/weaviate · error

create replicator for index %q: %w

Error message

create replicator for index %q: %w

What it means

NewIndex instantiates a replica.Replicator used for replication operations; failure here aborts index creation. The underlying error typically indicates the replica router, node resolver, or deletion strategy wiring is invalid — per the TODO, replicator instantiation is per-index rather than top-level, so misconfiguration surfaces here.

Source

Thrown at adapters/repos/db/index.go:518

		namespacesExister:       cfg.NamespacesExister,
		namespace:               namespacing.NamespaceFromQualified(string(cfg.ClassName)),
		shardReindexer:          shardReindexer,
		router:                  router,
		shardResolver:           shardResolver,
		bitmapBufPool:           bitmapBufPool,
		tenantsManager:          tenantsManager,
	}
	index.closeRequestedCtx, index.signalCloseRequested = context.WithCancelCause(context.Background())
	index.stopwordProvider.Store(stopwords.NewProvider(sd, presetDetectors))

	getDeletionStrategy := func() string {
		return index.DeletionStrategy()
	}

	// TODO: Fix replica router instantiation to be at the top level
	index.replicator, err = replica.NewReplicator(cfg.ClassName.String(), router, nodeResolver, sg.NodeName(), getDeletionStrategy, replicaClient, promMetrics, logger)
	if err != nil {
		return nil, fmt.Errorf("create replicator for index %q: %w", index.ID(), err)
	}

	if cfg.AsyncReplicationScheduler == nil && cfg.ReplicationFactor > 1 {
		return nil, fmt.Errorf("init index %q: async replication scheduler is required when ReplicationFactor > 1", cfg.ClassName.String())
	}
	if globalReplicationConfig == nil && cfg.ReplicationFactor > 1 {
		return nil, fmt.Errorf("init index %q: global replication config is required when ReplicationFactor > 1", cfg.ClassName.String())
	}
	index.asyncReplicationScheduler = cfg.AsyncReplicationScheduler

	index.closingCtx, index.closingCancel = context.WithCancel(context.Background())

	index.initCycleCallbacks()

	if err := index.checkSingleShardMigration(); err != nil {
		return nil, errors.Wrap(err, "migrating sharding state from previous version")
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify cluster node configuration: all schema node names must resolve in nodeResolver
  2. Check replication-related config (deletion strategy, router) for invalid/nil values
  3. Ensure the class schema's replication settings match cluster reality (nodes present, names correct)
  4. Inspect the wrapped error from replica.NewReplicator for the precise configuration fault
Defensive patterns

Strategy: validation

Validate before calling

// before creating the collection, verify replication config matches the cluster
if cfg.ReplicationFactor > len(clusterNodes) { /* invalid config */ }
// verify every node in the class's node list resolves in the cluster
class.Nodes.forEach(n => cluster.MustResolve(n))

Try / catch

idx, err := NewIndex(...)
if err != nil && strings.Contains(err.Error(), "create replicator for index") {
  // fix replication/cluster config before retrying collection creation
}

Prevention

When it happens

Trigger: replica.NewReplicator returns an error during index creation — e.g. invalid router/deletion strategy configuration, node resolver unable to resolve nodes, or bad replication-related config for the class.

Common situations: Cluster misconfiguration where node names in the schema don't resolve via nodeResolver; using custom replication configs after an upgrade; tests with nil router/deletion strategy mocks.

Related errors


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