{"record":{"id":"d4abe043995959f2","repo":"weaviate/weaviate","slug":"get-replication-details-for-q-w","errorCode":null,"errorMessage":"get replication details for %q: %w","messagePattern":"get replication details for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cluster/raft_replication_apply_endpoints.go","lineNumber":33,"sourceCode":"\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-openapi/strfmt\"\n\t\"github.com/google/uuid\"\n\t\"github.com/weaviate/weaviate/cluster/proto/api\"\n\t\"github.com/weaviate/weaviate/cluster/replication\"\n\treplicationTypes \"github.com/weaviate/weaviate/cluster/replication/types\"\n)\n\nfunc (s *Raft) ApplyReplicationScalePlan(ctx context.Context, scalePlan api.ReplicationScalePlan) (opsUUIDs []strfmt.UUID, err error) {\n\t// while not strictly necessary, scaling while there are ongoing replications is disallowed\n\tops, err := s.GetReplicationDetailsByCollection(ctx, scalePlan.Collection)\n\tif err != nil && !errors.Is(err, replicationTypes.ErrReplicationOperationNotFound) {\n\t\treturn nil, fmt.Errorf(\"get replication details for %q: %w\", scalePlan.Collection, err)\n\t}\n\tfor _, op := range ops {\n\t\tif api.ShardReplicationState(op.Status.State) != api.CANCELLED && api.ShardReplicationState(op.Status.State) != api.READY {\n\t\t\treturn nil, fmt.Errorf(\"cannot scale while there are ongoing replications for collection %q\", scalePlan.Collection)\n\t\t}\n\t}\n\n\t// validate scale plan\n\tfor shardName, shardActions := range scalePlan.ShardReplicationScaleActions {\n\t\tsourceNodeUsage := make(map[string]int)\n\n\t\tfor newNode, sourceNode := range shardActions.AddNodes {\n\t\t\tif newNode == sourceNode {\n\t\t\t\treturn nil, fmt.Errorf(\"node %q in shard %q cannot be added as replica from itself\", newNode, shardName)\n\t\t\t}\n\n\t\t\tif _, isBeingRemoved := shardActions.RemoveNodes[newNode]; isBeingRemoved {\n\t\t\t\treturn nil, fmt.Errorf(\"node %q in shard %q cannot be both removed and added\", newNode, shardName)","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/cluster/raft_replication_apply_endpoints.go#L15-L51","documentation":"ApplyReplicationScalePlan first lists existing replication operations for the target collection via GetReplicationDetailsByCollection before allowing a scale. This error wraps any failure of that lookup other than ErrReplicationOperationNotFound (which is treated as 'no ongoing ops'). It means the pre-flight check itself failed, so the scale plan is rejected without applying anything.","triggerScenarios":"Calling ApplyReplicationScalePlan (or the replication scale-plan REST/gRPC API) when the in-memory replication ops store is unavailable/errored, the context is cancelled or times out, or the collection lookup returns an unexpected error.","commonSituations":"Requesting a scale plan while the node is starting up or the replication state store is corrupted/reindexing; client timeouts cancelling the context mid-lookup; schema manager not ready after leader change.","solutions":["Retry the scale-plan request once the node is fully started and the leader is stable.","Check weaviate logs for the underlying error from GetReplicationDetailsByCollection to fix the storage/state cause.","Increase the client request timeout if context deadline exceeded is the wrapped cause.","If the replication state store is corrupted, restart the node or use force-delete replication endpoints to reset op state before scaling."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// poll node readiness before scaling\n// GET /v1/nodes → ensure all nodes report status HEALTHY and a leader exists","typeGuard":null,"tryCatchPattern":"var ops []strfmt.UUID\nerr := retry.Do(func() error {\n\tops, err = cluster.ApplyReplicationScalePlan(ctx, plan)\n\tif err != nil && strings.Contains(err.Error(), \"get replication details\") {\n\t\treturn retry.RetryableError(err) // transient state-store/context issue\n\t}\n\treturn err\n}, retry.Attempts(3), retry.Delay(2*time.Second))","preventionTips":["Only run scale-plan requests against a fully started cluster with a stable leader.","Use generous client timeouts for replication admin APIs.","Watch for startup/leader-change logs before automating scale operations."],"tags":["go","raft","replication","scaling"],"backgroundTag":"replication-state-unavailable","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"}