{"record":{"id":"98f21ab2672d6d55","repo":"weaviate/weaviate","slug":"create-replicator-for-index-q-w","errorCode":null,"errorMessage":"create replicator for index %q: %w","messagePattern":"create replicator for index %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/index.go","lineNumber":518,"sourceCode":"\t\tnamespacesExister:       cfg.NamespacesExister,\n\t\tnamespace:               namespacing.NamespaceFromQualified(string(cfg.ClassName)),\n\t\tshardReindexer:          shardReindexer,\n\t\trouter:                  router,\n\t\tshardResolver:           shardResolver,\n\t\tbitmapBufPool:           bitmapBufPool,\n\t\ttenantsManager:          tenantsManager,\n\t}\n\tindex.closeRequestedCtx, index.signalCloseRequested = context.WithCancelCause(context.Background())\n\tindex.stopwordProvider.Store(stopwords.NewProvider(sd, presetDetectors))\n\n\tgetDeletionStrategy := func() string {\n\t\treturn index.DeletionStrategy()\n\t}\n\n\t// TODO: Fix replica router instantiation to be at the top level\n\tindex.replicator, err = replica.NewReplicator(cfg.ClassName.String(), router, nodeResolver, sg.NodeName(), getDeletionStrategy, replicaClient, promMetrics, logger)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create replicator for index %q: %w\", index.ID(), err)\n\t}\n\n\tif cfg.AsyncReplicationScheduler == nil && cfg.ReplicationFactor > 1 {\n\t\treturn nil, fmt.Errorf(\"init index %q: async replication scheduler is required when ReplicationFactor > 1\", cfg.ClassName.String())\n\t}\n\tif globalReplicationConfig == nil && cfg.ReplicationFactor > 1 {\n\t\treturn nil, fmt.Errorf(\"init index %q: global replication config is required when ReplicationFactor > 1\", cfg.ClassName.String())\n\t}\n\tindex.asyncReplicationScheduler = cfg.AsyncReplicationScheduler\n\n\tindex.closingCtx, index.closingCancel = context.WithCancel(context.Background())\n\n\tindex.initCycleCallbacks()\n\n\tif err := index.checkSingleShardMigration(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"migrating sharding state from previous version\")\n\t}\n","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/index.go#L500-L536","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify cluster node configuration: all schema node names must resolve in nodeResolver","Check replication-related config (deletion strategy, router) for invalid/nil values","Ensure the class schema's replication settings match cluster reality (nodes present, names correct)","Inspect the wrapped error from replica.NewReplicator for the precise configuration fault"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before creating the collection, verify replication config matches the cluster\nif cfg.ReplicationFactor > len(clusterNodes) { /* invalid config */ }\n// verify every node in the class's node list resolves in the cluster\nclass.Nodes.forEach(n => cluster.MustResolve(n))","typeGuard":null,"tryCatchPattern":"idx, err := NewIndex(...)\nif err != nil && strings.Contains(err.Error(), \"create replicator for index\") {\n  // fix replication/cluster config before retrying collection creation\n}","preventionTips":["Ensure all node names referenced in the schema resolve in nodeResolver","Set replicationFactor <= number of healthy cluster nodes","Validate replication config in CI with a minimal cluster before production rollout"],"tags":["replication","index","startup","configuration"],"backgroundTag":"replicator-init-failed","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"}