Source shard routingEntry is not an active primary – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch tries to perform an operation on a shard that is not an active primary. This could be due to a network partition, node failure, or shard relocation. To resolve this issue, you can try the following: 1) Check the cluster health and ensure all nodes are up and running. 2) Verify the shard allocation and ensure the primary shard is active. 3) If the primary shard is not active, you may need to manually reroute the shard or restart the node. 4) Ensure your cluster has enough resources to handle the load.

This guide will help you check for common problems that cause the log ” source shard [” + routingEntry + “] is not an active primary ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: routing, recovery, indices, shard, source.

Log Context

Log “source shard [” + routingEntry + “] is not an active primary” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 final IndexShard shard = indexService.getShard(request.shardId().id());  final ShardRouting routingEntry = shard.routingEntry();  if (routingEntry.primary() == false || == false) {
 throw new DelayRecoveryException("source shard [" + routingEntry + "] is not an active primary");
 }  if (request.isPrimaryRelocation()
 && (routingEntry.relocating() == false || routingEntry.relocatingNodeId().equals(request.targetNode().getId()) == false)) {


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?