Inference task cancelled with reason %s – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.4-8.9

Briefly, this error occurs when an inference task in Elasticsearch is cancelled due to a specific reason, which is indicated by [%s]. This could be due to a variety of reasons such as resource constraints, configuration issues, or network problems. To resolve this issue, you can check the server logs for more detailed information about the cancellation reason. Then, depending on the reason, you may need to adjust your resource allocation, fix your configuration, or troubleshoot your network.

This guide will help you check for common problems that cause the log ” Inference task cancelled with reason [%s] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, task.

Log Context

Log “Inference task cancelled with reason [%s]” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 // Always fail immediately and return an error
 ex -> true
 request.getObjectsToInfer().forEach(stringObjectMap -> typedChainTaskExecutor.add(chainedTask -> {
 if (task.isCancelled()) {
 throw new TaskCancelledException(format("Inference task cancelled with reason [%s]"; task.getReasonCancelled()));
 model.infer(stringObjectMap; request.getUpdate(); chainedTask);
 }));  typedChainTaskExecutor.execute(ActionListener.wrap(inferenceResultsInterfaces -> {