weaviate/weaviate · error

no write replica found

Error message

no write replica found

What it means

The single-tenant write plan builder found no writable replicas for the target shard(s). Unlike reads (which list offending shards), this check catches the fully-empty write replica set after getWriteReplicasLocation succeeded — typically all replicas were filtered out by the replication FSM (none in a writable state) or no replica hostname could be resolved.

Source

Thrown at cluster/router/router.go:403

}

// BuildWriteRoutingPlan constructs a write routing plan for single-tenant collections.
func (r *singleTenantRouter) BuildWriteRoutingPlan(params types.RoutingPlanBuildOptions) (types.WriteRoutingPlan, error) {
	if err := r.validateTenant(params.Tenant); err != nil {
		return types.WriteRoutingPlan{}, err
	}
	return r.buildWriteRoutingPlan(params)
}

// buildWriteRoutingPlan constructs a write routing plan for single-tenant collections.
func (r *singleTenantRouter) buildWriteRoutingPlan(params types.RoutingPlanBuildOptions) (types.WriteRoutingPlan, error) {
	writeReplicas, err := r.getWriteReplicasLocation(r.collection, params.Tenant, params.Shard)
	if err != nil {
		return types.WriteRoutingPlan{}, err
	}

	if len(writeReplicas.Replicas) == 0 {
		return types.WriteRoutingPlan{}, fmt.Errorf("no write replica found")
	}

	cl, err := writeReplicas.ValidateConsistencyLevel(params.ConsistencyLevel)
	if err != nil {
		return types.WriteRoutingPlan{}, err
	}

	sortedWriteReplicas := sort(writeReplicas.Replicas, preferredNode(params.DirectCandidateNode, r.nodeSelector.LocalName()))

	plan := types.WriteRoutingPlan{
		Shard:  params.Shard,
		Tenant: params.Tenant,
		ReplicaSet: types.WriteReplicaSet{
			Replicas: sortedWriteReplicas,
		},
		ConsistencyLevel:    params.ConsistencyLevel,
		IntConsistencyLevel: cl,
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check replica states for the shard and wait for replication operations to finish before writing
  2. Ensure replica nodes are up, cluster members, and resolvable by hostname
  3. Retry the write after the cluster topology settles
  4. Re-add replicas (increase replication factor / trigger replica copy) for the affected shard
Defensive patterns

Strategy: retry

Validate before calling

// Go: check replication status for the shard before writes
// GET /v1/nodes or replication op endpoints should show no active REPLICA_COPY on target shard

Try / catch

plan, err := router.BuildWriteRoutingPlan(opts)
if err != nil && err.Error() == "no write replica found" {
  // backoff + retry; escalate if no replica becomes writable within SLA
}

Prevention

When it happens

Trigger: BuildWriteRoutingPlan on a single-tenant collection where FilterOneShardReplicasWrite returns no nodes for the target shard(s) or all replica hostnames fail resolution, so writeReplicas.Replicas is empty.

Common situations: Writing while all replicas of the shard are undergoing replication/copy (cowitness state); replica nodes offline or removed; writes to a freshly created collection before replicas are ready.

Related errors


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