Operation only allowed when shard state is one of – How to solve this OpenSearch exception

Opster Team

Aug-23, Version: 1-1.1

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your OpenSearch operation.

Briefly, this error occurs when an operation is attempted on a shard in OpenSearch that is not in the correct state. The shard state must be one of the states specified in the error message for the operation to be successful. To resolve this issue, you can try the following: 1) Wait for the shard to transition to the correct state, 2) Manually change the shard state if possible, 3) Check for any issues causing the shard to be stuck in its current state, such as network issues or disk space problems, and resolve them.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” operation only allowed when shard state is one of ” to appear. To understand the issues related to this log, read the explanation below about the following OpenSearch concepts: shard, index.

Log Context

Log “operation only allowed when shard state is one of” class name is IndexShard.java. We extracted the following from OpenSearch source code for those seeking an in-depth context :

 assert origin == Engine.Operation.Origin.LOCAL_RESET;
 assert getActiveOperationsCount() == OPERATIONS_BLOCKED
 : "locally resetting without blocking operations; active operations are [" + getActiveOperations() + "]";
 if (writeAllowedStates.contains(state) == false) {
 throw new IllegalIndexShardStateException(shardId; state; "operation only allowed when shard state is one of " +
 writeAllowedStates + "; origin [" + origin + "]");


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?

Get expert answers on Elasticsearch/OpenSearch