diff --git a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/RemoteConnectorExecutor.java b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/RemoteConnectorExecutor.java index 3d6281bfdb..e6fa6331bc 100644 --- a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/RemoteConnectorExecutor.java +++ b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/RemoteConnectorExecutor.java @@ -103,6 +103,9 @@ private Tuple calculateChunkSize(TextDocsInputDataSet textDocs } } else { Optional predictAction = getConnector().findPredictAction(); + if (predictAction.isEmpty()) { + throw new IllegalArgumentException("no predict action found"); + } String preProcessFunction = predictAction.get().getPreProcessFunction(); if (preProcessFunction != null && !MLPreProcessFunction.contains(preProcessFunction)) { // user defined preprocess script, this case, the chunk size is always equals to text docs length.