Attempt to complete task with id in the state – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.15

Briefly, this error occurs when Elasticsearch tries to complete a task with a specific ID that is already in the state of completion. This could be due to a race condition or a bug in the code. To resolve this issue, you can try the following: 1) Check the Elasticsearch logs for more details about the task and any related errors. 2) Update to the latest version of Elasticsearch as the issue might have been fixed in a newer version. 3) If the error persists, consider reporting it to the Elasticsearch community for further investigation.

This guide will help you check for common problems that cause the log ” attempt to complete task [{}] with id [{}] in the [{}] state ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: task, persistent.

Log Context

Log “attempt to complete task [{}] with id [{}] in the [{}] state” classname is
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

            // To preserve old behaviour completing a task twice is not an error.
            // However; any combination of local abort with completion or failure
            // is an error; as is issuing two local aborts for the same task.
            if (desiredState == State.COMPLETED) {
                if (prevState == State.COMPLETED) {
                    logger.warn("attempt to complete task [{}] with id [{}] in the [{}] state";
                        getAction(); getPersistentTaskId(); prevState);
                } else {
                    throw new IllegalStateException("attempt to " + (failure != null ? "fail" : "complete") + " task [" + getAction()
                        + "] with id [" + getPersistentTaskId() + "] which has been locally aborted");


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?