Has privilege task cancelled – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.4-8.9

Briefly, this error occurs when a task in Elasticsearch is cancelled due to insufficient user privileges. This could be due to the user not having the necessary permissions to execute the task or the task exceeding the allowed execution time. To resolve this issue, you can either grant the necessary permissions to the user or increase the task execution time limit. Additionally, ensure that the task is not being unnecessarily blocked by other tasks.

This guide will help you check for common problems that cause the log ” has privilege task cancelled ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, task.

Log Context

Log “has privilege task cancelled” class name is TransportProfileHasPrivilegesAction.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 ActionListener.wrap(applicationPrivilegeDescriptors -> threadPool.generic().execute(() -> {
 for (Map.Entry profileUidToSubject : profileSubjectsAndFailures.results()) {
 // return the partial response if the "has privilege" task got cancelled in the meantime
 if (((CancellableTask) task).isCancelled()) {
 listener.onFailure(new TaskCancelledException("has privilege task cancelled"));
 final String profileUid = profileUidToSubject.getKey();
 final Subject subject = profileUidToSubject.getValue();