weaviate/weaviate · error
shard %s of class %s has no assigned nodes
Error message
shard %s of class %s has no assigned nodes
What it means
ShardOwnership validates that every physical shard in the class's sharding state has at least one node in BelongsToNodes. A shard with an empty BelongsToNodes list has no owner, so shards cannot be assigned to nodes for a balanced export; the read fails immediately with this error.
Source
Thrown at adapters/repos/db/export.go:56
// are write-locked simultaneously. Short enough that the added latency
// (vs. event-driven wake-up) is negligible compared to typical lock hold
// times (shard load/unload), long enough to keep CPU overhead trivial.
const lockPollInterval = 5 * time.Millisecond
// ShardOwnership returns a map of node name to shard names for a given class.
// Shards are distributed across their replica nodes using a least-loaded
// strategy so that export work is balanced across the cluster.
func (db *DB) ShardOwnership(ctx context.Context, className string) (map[string][]string, error) {
shardNodes := make(map[string][]string)
err := db.schemaReader.Read(className, true, func(_ *models.Class, state *sharding.State) error {
if state == nil {
return fmt.Errorf("unable to retrieve sharding state for class %s", className)
}
for shardName, shard := range state.Physical {
if len(shard.BelongsToNodes) == 0 {
return fmt.Errorf("shard %s of class %s has no assigned nodes", shardName, className)
}
// Filter out empty node names to avoid assigning shards to an invalid node.
validNodes := make([]string, 0, len(shard.BelongsToNodes))
for _, node := range shard.BelongsToNodes {
if node != "" {
validNodes = append(validNodes, node)
}
}
if len(validNodes) == 0 {
return fmt.Errorf("shard %s of class %s has only empty assigned nodes", shardName, className)
}
shardNodes[shardName] = validNodes
}
return nil
})View on GitHub (pinned to 75aa4b6d11)
Solutions
- Inspect the sharding state (nodes/replication status endpoints) to find the unassigned shard
- Run the shard replication/rebalance mechanism to assign nodes to the shard
- If the shard is orphaned (no data needed), delete it so the sharding state is consistent
- Restore a consistent sharding state from a cluster snapshot if assignment metadata is lost
Defensive patterns
Strategy: validation
Validate before calling
// Inspect sharding state before export; fail fast on unassigned shards
err := db.schemaReader.Read(className, true, func(_ *models.Class, st *sharding.State) error {
for name, shard := range st.Physical {
if len(shard.BelongsToNodes) == 0 {
return fmt.Errorf("shard %s unassigned; fix before export", name)
}
}
return nil
}) Try / catch
_, err := db.ShardOwnership(ctx, className)
if err != nil && strings.Contains(err.Error(), "has no assigned nodes") {
// trigger replication/rebalance or delete the orphaned shard before exporting
return err
} Prevention
- Ensure shard creation/replication jobs complete before exporting
- Monitor cluster replication status; alert on shards with no owner
- Never hand-edit sharding state; use the replication APIs
When it happens
Trigger: Calling ShardOwnership when the class's sharding.State.Physical map contains a shard whose BelongsToNodes slice is empty/nil — e.g. shard metadata created but replica assignment never committed (interrupted shard creation, corrupted sharding state).
Common situations: Crashed or interrupted shard creation/migration in a cluster; restoring a partial backup; shard rebalancing that left a shard unassigned; exporting a class right after adding shards that have not been fully assigned.
Related errors
- failed to get shard ownership for class %s: %w
- prepare request: %w
- prepare failed: status %d (%s)
- commit request: %w
- commit failed: status %d (%s)
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/d86c380b2f4451d5.
Report an issue: GitHub.