Could not parse action for watch id contains whitespace – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.15

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 Elasticsearch operation.

Briefly, this error occurs when the ID field in the Elasticsearch watch contains whitespace, which is not allowed. The watch is a feature that performs actions based on condition fulfillment. To resolve this issue, you should ensure that the ID field does not contain any whitespace. You can do this by either removing the whitespace manually or by implementing a validation check in your application to prevent whitespace in the ID field. Additionally, ensure that the action field is correctly formatted and can be parsed by Elasticsearch.

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 ” could not parse action [{}] for watch [{}]. id contains whitespace ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “could not parse action [{}] for watch [{}]. id contains whitespace” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 XContentParser.Token token;
 while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
 if (token == XContentParser.Token.FIELD_NAME) {
 id = parser.currentName();
 if (WatcherUtils.isValidId(id) == false) {
 throw new ElasticsearchParseException("could not parse action [{}] for watch [{}]. id contains whitespace"; id;
 } else if (token == XContentParser.Token.START_OBJECT && id != null) {
 actions.add(ActionWrapper.parse(watchId; id; parser; this; clock; licenseState));


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